[Python] Display marker on OSM map?


Would someone have some Python code handy to just display a single marker on top of an OSM map?

from GPSPhoto import gpsphoto

data = gpsphoto.getGPSData("somefile.jpg")
latitude = data['Latitude']
longitude = data['Longitude']

#How to display location on top of OSM map?
print(file, data['Latitude'], data['Longitude'])

FWIW, the GUI uses TclTk (ie. tkinter).

Thank you.

Alternatively, is there a way to just query OSM with a location, and get a static JPG/PNG back? I just need to show users a map of the location.

Apparently, the only service available is staticMapLite, but it’s not reliable and it complains with “Please verify a valid referrer when using the static map script.”


Edit: Here’s what I’d like to get, by just calling a URL with the right params, and getting a JPG/PNG back:

Also interested. Let me know if you find out how. There was a while back, a way to write a program to “snapshot” a page (non-interactive) by calling the openstreetmap page with the requested coordinates. Unfortunately, I couldn’t find it after searching extensively for it. Maybe somebody remembers.

Hi guys,

I can help you in this case, have a look towards the following code in which I am first plotting lat, long and track and then on OSM using mplleaflet library.

fig = plt.figure()
plt.plot(plot_coords['lon'].values, plot_coords['lat'].values)
plt.plot(plot_coords['lon'].values, plot_coords['lat'].values, 'ro')

after this:

# if you are using notebook 
# for pycharm or command line