Skip to main content

Stitch together Google Maps images from lat, long coordinates using the Static Maps API.

Project description

GMaps Image Fetcher

Simple tool to download and stitch together image tiles from Google Maps via the Static-Maps API

preview image

How it works

  • Give the tool two sets of latitudes and longitudes for the north-west and south-east of the area you wish to download the imagery from
  • The tool calculates how many individual image tiles it needs to get from Google's Static-Maps API and begins to download them
  • All image tiles are stitched together and a preview showed onscreen
  • The image is saved to a file in your chosen format (PNG, JPG, or BMP)

Installation

Prerequisites

  • A GOOGLE_MAPS_API_KEY is required as per the T&Cs of Google's Static-Maps API (plenty of tutorials online showing you how to generate this, Google it)
  • Please ensure to enable the Static Maps API also in your account

Install from PyPI

pip install gmaps-image-fetcher

Install from GitHub

pip install git+https://github.com/joseph-holland/gmaps-image-fetcher.git

Running

  1. Set your GOOGLE_MAPS_API_KEY environment variable

    Windows

    set GOOGLE_MAPS_API_KEY=AIzaS.............
    

    Linux/macOS

    export GOOGLE_MAPS_API_KEY=AIzaS.............
    
  2. Run the tool and give it the NW lat/lon and SE lat/lon as well as a zoom level (1= world, 20=buildings)

    gmaps-image-fetcher -nw 53.369745 -6.348743 -se 53.348326 -6.296656 -z 16
    
  3. The tool will calculate how many image tiles it will need to retrieve and prompt if you wish to continue

    Retrieve 15 image tiles from Google static-maps API
    Do you want to continue y/n: y
    
  4. It will then download the image tiles, stitch them together, show the image onscreen and save to the local directory

    satellite sample

Command-line Options

Option Description
-nw, --northwest Northwest latitude/longitude coordinates
-se, --southeast Southeast latitude/longitude coordinates
-z, --zoom Zoom level from 1 (world) to 20+ (buildings), default is 18
-sc, --scale Scale factor for Google Maps API (1 or 2), default is 1, 2 is for high resolution
-f, --format Output image format (png, jpg, bmp), default is png
--delay Delay between API requests in seconds, default is 0.5; used in case of Google API rate limits
-d, --debug Enable debug output
-l, --logfile Logfile to write
--version Show the version number and exit

Examples

Save a high-resolution image with scale factor 2:

gmaps-image-fetcher -nw 53.369745 -6.348743 -se 53.348326 -6.296656 -z 16 -sc 2

Save as JPEG format for smaller file size:

gmaps-image-fetcher -nw 53.369745 -6.348743 -se 53.348326 -6.296656 -z 16 -f jpg

Increase delay between API calls to avoid rate limits:

gmaps-image-fetcher -nw 53.369745 -6.348743 -se 53.348326 -6.296656 -z 16 --delay 1.0

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

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

gmaps_image_fetcher-1.0.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

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

gmaps_image_fetcher-1.0.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file gmaps_image_fetcher-1.0.0.tar.gz.

File metadata

  • Download URL: gmaps_image_fetcher-1.0.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for gmaps_image_fetcher-1.0.0.tar.gz
Algorithm Hash digest
SHA256 80c050581f02df2de3092299c35ff1c7684680d9ded35b1ece80735c9611dbca
MD5 a38094ffb60bd68f78ab89dec1595736
BLAKE2b-256 aa1cc1ec0d368ab742809baa836cd7a51d4f5b07b0d4f4820fba69e867404812

See more details on using hashes here.

File details

Details for the file gmaps_image_fetcher-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gmaps_image_fetcher-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f6009fc02ef3fa60f5c4d5a1927e8f6d98d3c4624fb5a5f244c2da3395a500d
MD5 5272794d43dd1e1e4ebda1be0fbb66d6
BLAKE2b-256 a38cf6d3bd43b5c9e29bce65c357a593bd4c9c4dc35f8363c303e188781634a5

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