I need to get coordinates of a place from OSM. When I search OSM by name I get the output like this:
https://nominatim.openstreetmap.org/details.php?osmtype=N&osmid=6346201933&class=tourism&format=json
I am trying to figure out how to format my API call. I have couple parameters to search for such as:
but I believe the API also needs OSM ID, which I'm not sure where I can get. A bit lost here...
The api documentation describes this:
https://nominatim.org/release-docs/develop/api/Search/
I quote from the documentation:
The search API has the following format:
https://nominatim.openstreetmap.org/search?<params>
Example JSON with address details:
https://nominatim.openstreetmap.org/?addressdetails=1&q=bakery+in+berlin+wedding&format=json&limit=1
You get the output:
I need to get coordinates of a place from OSM.
As you can see from the above image, the json contains the lat, lon, and osm_id, which you can parse from the json response.
If you see the documentation, there is detailed information on the different ways you can make requests, and the format of output parameters.
In your case, you mention you would like to use the local name and state. I do not know what you mean by local name, but the parameters section clearly shows how you can use street, city, county, state, country and postal code.
If you get stuck, please post a detailed question of what you're trying to do, and I'm sure more people would be glad to help.