Draw a map with gps markers and save this image to

2019-03-30 17:23发布

问题:

I have some GPS position recordings, which I want to draw into a map (e.g. OpenStreetMap) and save this as an image file.

I'm using python. I've found osm-gps-map as a candidate library to do the visualization, but apparantly the API lacks some functionality to satisfy all of my needs. What I need is a library that does:

  • draw stuff into a map (e.g. an OSM-based map), i.e. a list of GPS positions.
  • automatically adjust view (scale/position) to fit in all drawn positions
  • save this view to an image file

I seriously want to avoid being forced to manually make a screenshot from a widget or a browser window. And if possible I also want to avoid to implement the necessary projection functionality by myself (as in here). Does anyone know a library/toolchain that provides the desired functionality (if possible for use by Python)?

回答1:

You may want to consider using Basemap for matplotlib. Here is a blog post describing how to use this package with OSM.



回答2:

There are examples of how to draw custom GPS points on top of OSM background map using Matplotlib Basemap, Matplotlib or Cairo in GeoTiler project: https://github.com/wrobell/geotiler/tree/master/examples.