Shohreh
(Shohreh)
1
Hello,
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.
Shohreh
(Shohreh)
2
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.”
https://staticmap.openstreetmap.de/staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=mapnik&markers=40.702147,-74.015794,lightblue
Edit: Here’s what I’d like to get, by just calling a URL with the right params, and getting a JPG/PNG back:

kucai
(Kucai)
3
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.
plt.figure(figsize=(8,6))
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
mplleaflet.display(fig=fig)
# for pycharm or command line
mplleaflet.show(fig=fig)
Thanks,
Qazi