This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How can I use python to get my lat,lon in OSM?

0

I have try geocode to get my lat and lon , but not current

it is get by my ip and conver to lat,lon

Can help me osm(openstreetmap) api can get my current lat and lon?

import geocoder
g = geocoder.ip('me')
print(g.latlng)

and

freegeoip = "http://freegeoip.net/json"
geo_r = requests.get(freegeoip)
geo_json = geo_r.json()

user_postition = [geo_json["latitude"], geo_json["longitude"]]

print(user_postition)

asked 13 Aug '17, 09:50

Arvis_Su's gravatar image

Arvis_Su
11224
accept rate: 0%

edited 13 Aug '17, 09:50


One Answer:

1

OpenStreetMap doesn't offer a geolocation API. However you can find various geolocation services and databases on the Internet. Some of them are mentioned here: https://opendata.stackexchange.com/questions/2087/ip-geocoding-data-sources-and-or-apis

answered 14 Aug '17, 08:20

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

Source code available on GitHub .