I developed an open-source APP in Cordova (it uses Javascript) and I'm using the Google Maps API, though as the APP is becoming popular my bill is increasing (not nice for a free, ad-free APP). Thus I'd like to move to Open Street Maps.

I've been reading the docs about the Overpass API but I see no simple clear examples of code implementation. I know the sever to use, that I should use HTTP GET requests and use their special XML syntax. But it's not clear how do I pass that XML to the GET request. Furthermore the examples regarding coordinates provides as input a boundary box, not a point (or a point is considered as a square whose corners are the same?).

Could you kindly provide a simple example in Javascript (for example with $.ajax) on how to get the address of a certain location by providing the geo-coordinates to the API?

asked 06 Mar, 14:23

Jo%C3%A3o's gravatar image

accept rate: 0%

edited 06 Mar, 16:39

Spiekerooger's gravatar image


What you are looking for is reverse geocoding. This is rather a job for Nominatim - see https://nominatim.org for documentation. And there you can use json responses that are much easier for you to use. Please respect the nominatim usage policy - to be found here: https://operations.osmfoundation.org/policies/nominatim/ . It's maybe not a good idea to hardcode the nominatim endpoint operated by osm into an app. So maybe you would have to install your own nominatim instance or use one of the providers listed here: https://wiki.openstreetmap.org/wiki/Nominatim#Alternatives_.2F_Third-party_providers .

permanent link

answered 06 Mar, 16:36

Spiekerooger's gravatar image

accept rate: 17%

edited 06 Mar, 16:42

Thanks a lot, what do you think about my solution? https://github.com/jfoclpf/form-for-parking-violation/issues/85 and yes, I will respect the usage policy, surely much less than 1 request per second. Right now my APP has something like 2000 requests per month

(06 Mar, 19:06) João

Looks good. I would add a version number to your User-Agent string, e.g.

xhr.setRequestHeader('User-Agent', 'com.form.parking.violation v0.1');

And 2000 a month does not sound like too much. But then versioning helps if the app gets more users and you have to change sth if v0.1 gets to many requests.

Please don't don't forget to accept the answer with the nominatim hint above if that helped.

(06 Mar, 19:37) Spiekerooger

Thanks again, I also shared the result in Stackoverflow: https://stackoverflow.com/a/66509433/1243247

(07 Mar, 13:11) João

btw, I realized now I can't change the http request headers (browsers won't allow it). May I use instead other means of ID, for example the email address such as seen here?

(07 Mar, 14:11) João
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 06 Mar, 14:23

question was seen: 181 times

last updated: 07 Mar, 14:11

powered by OSQA