Skip to main content

Download satellite images from Google Maps.

Project description

maps4fsmaps4fs UImaps4fs Datamaps4fs APImaps4fs Statsmaps4fs Bot
pygmdlpydtmdl

Quick Start

  1. Install the package via pip:
pip install pygmdl
  1. Import the package and use it:
import pygmdl

lat = 35.681236
lon = 139.767125
size = 2000
output_path = "satellite_image.png"

pygmdl.save_image(lat, lon, size, output_path)

It will took a while to download the image, but as soon as it's done, you will see the image in the specified path.

Overview

This package is designed to download satellite images from Google Maps in a simple way. This repository is a fork of satmap_downloader, which provides CLI to download satellite images. So if you need a CLI tool, please use the original repository.

How to Use

Here, you'll find the detailed explanation of the save_image function.

Function signature

def save_image(
    lat: float,
    lon: float,
    size: int,
    output_path: str,
    rotation: int = 0,
    zoom: int = 18,
    from_center: bool = False,
    logger: Logger | None = None,
) -> str:

Note, that by default the function expects that provided coordinates (lat, lon) are coordinates of the top-left corner of the image. If you want to provide the coordinates of the center of the image, you can set from_center to True.

Function arguments

Parameters Type Description
lat float Latitude of the point to download the image from.
lon float Longitude of the point to download the image from.
size int Size of the ROI in meters.
output_path str Path to save the image.
rotation int Rotation of the image in degrees (CW).
zoom int Zoom level for images (higher values = higher resolution).
from_center bool If True, the provided coordinates will be treated as the center of the image.
logger Logger | None Logger to use for logging. If None, the default logger will be used.

Return value

The function returns the path to the saved image (the same as output_path).

Usage example

import pygmdl

lat = 35.681236
lon = 139.767125
size = 2000
output_path = "satellite_image.png"
rotation = 25
zoom = 16
from_center = True

pygmdl.save_image(lat, lon, size, output_path, rotation, zoom, from_center)

As a result, you will get the satellite image of a region 2000x2000 meters around the point with coordinates (35.681236, 139.767125) with the center of the image at these coordinates. The image will be rotated by 25 degrees clockwise and will be downloaded with zoom level 16.

Bugs and Feature Requests

If you find a bug or have a feature request, please open an issue on the issues page.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygmdl-0.2.4.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygmdl-0.2.4-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file pygmdl-0.2.4.tar.gz.

File metadata

  • Download URL: pygmdl-0.2.4.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pygmdl-0.2.4.tar.gz
Algorithm Hash digest
SHA256 75901379c877bd4275d922ce6d3bb00d77e4b92b5eea1299e62e74b9e3ed47b7
MD5 9851de7b46eabd7a818d36094e9d5268
BLAKE2b-256 fd2b99aa8008ae6b664e44cd0c9dc5d7dfede00964ca81291961f160b718e2f3

See more details on using hashes here.

File details

Details for the file pygmdl-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: pygmdl-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pygmdl-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 22850d1b5ff060253c9e5b4d980735b9cbcf896751529f63cd810d3ca27765cf
MD5 8e2dbb64f805bf50a4b90a76ea02827d
BLAKE2b-256 5419e10b1ddf080f6d0f6544c29649da4d8bb0ff194259ec101ddd13b32bf1e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page