GooMPy: Interactive Google Maps for Python

3689656940?profile=original

My students and I like to write MAV applications in Python, and we were disappointed in that Google does not provide an interactive map-visualization API in that language. So we wrote one ourselves, which we call GooMPy.

GooMPy provides a Python interface to the Google Static Maps API, automatically downloading and stitching together map tiles into a single image that you can zoom and pan dynamically in your Python program. To support using maps when you don't have an internet connection, GooMPY provides a pre-fetching function that stores the tiles in a caching folder. To keep the amount of tile-downloading to a minimum, GooMPy doesn't have functions for adding waypoints or other annotations to the map through Google's API. We plan on implementing these feature ourselves in the future.

To run GooMPy you'll need the Python Image Library (PIL) or equivalent (Pillow for Windows and OS X) installed on your computer. The repository includes an example using Tkinter, though you should be able to use GooMPy with other toolkits like wx and Qt.

Because Google limits the number of tiles that you can download during a given time period, we recommend setting up an API key as described here. Once you have your key, put it in the file goompy/key.py, and GooMPy will use it in fetching map tiles. If you run out of downloads, the tiles will be black with a "capacity exceeded" image in them.

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Harry , yes Gmapcatcher is another map program but it is in gtk you cant use it in any other application.

  • how can be converted to the qt file ? and how can we change the location in the map as it is not fetching the longitude and latitude of India's cities.

  • GmapCatcher is another python map program. 

  • Useful for Google's aerial imagery layers but for maps I'd definitely recommend OpenStreetMap instead.  libchamplain's bindings are one option for a slippy-map (i.e. pan & zoom), but there are tons of other python libraries for OSM for the mapping API access (submitting and retrieving data), live rendering, routing engines, etc.

  • Randy -- cool, thanks!  We were trying to create something completely standalone, but it's nice to see that others are thinking Python.  More the merrier, as you say :^) 

  • Developer

    MAVProxy also has a map module and it looks like it's written in Python.  More the merrier though!

  • Thanks, Gerard!  My student and I looked long and hard for mapping support in Python, but somehow missed libchamplain.  I'm gonna try it out right now.  GooMPy is a total hack, so I'd prefer something more robust.

  • Very nice. Years ago, I used libchamplain a lot, which has support for lines, polygons and animated markers, but that hasn't been updated in a while. Very useful if you want to visualize things that are going on in a mission.

This reply was deleted.