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 asked 06 Mar '21, 14:23 João Spiekerooger |
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 . answered 06 Mar '21, 16:36 Spiekerooger 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 '21, 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 '21, 19:37)
Spiekerooger
Thanks again, I also shared the result in Stackoverflow: https://stackoverflow.com/a/66509433/1243247
(07 Mar '21, 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 '21, 14:11)
João
Based on the answers above I am able to get the information I need. But I want to do this the right way, within the guidelines. What do I need to do for my app, should I apply for permission, request a special kind of commercial account, pay for it, how? Thanks in advance :)
(05 Jan '23, 16:42)
freestyle212
@freestyle212: for internal testing or if you have a really small usage footprint, you may follow the guidelines as described in the Nominatim usage policy. If you do want to use it for a business use case or commercial application, you should either run your own nominatim instance or use one of the third party providers listed here: https://wiki.openstreetmap.org/wiki/Nominatim#Alternatives_.2F_Third-party_providers
(05 Jan '23, 16:47)
Spiekerooger
showing 5 of 6
show 1 more comments
|