GooMPy: Interactive Google Maps for Python

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.

Views: 7003

Comment by Gerard Toonstra on June 28, 2015 at 6:17pm

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.

Comment by Simon D. Levy on June 28, 2015 at 6:25pm

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.


Developer
Comment by Randy on June 28, 2015 at 7:40pm

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

Comment by Simon D. Levy on June 28, 2015 at 7:49pm

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 :^) 

Comment by Andrew Zaborowski on June 29, 2015 at 3:35am

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.

Comment by Harry on June 29, 2015 at 5:58am

GmapCatcher is another python map program. 

Comment by SAMRIDHI JAIN on June 1, 2018 at 10:08pm

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.

Comment by SAMRIDHI JAIN on June 1, 2018 at 10:10pm

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

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service