NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi - I want to use Nominatim's reverse geocoder to get a lat/lon for this node: 269908858 (Mérida, Yucatán, Mexico)

Here's the node on OSM:

https://www.openstreetmap.org/node/269908858

The node has lat/lon data according the XML provided by OSM API:

https://www.openstreetmap.org/api/0.6/node/269908858

However, when I pass it to Nominatim it returns an error:

https://nominatim.openstreetmap.org/reverse?osm_type=N&osm_id=269908858&format=json

(the code format tag on this board is subbing "&" for "&" so correct this manually before opening)

Error message:

Output:{"error":"Unable to geocode"}

What's missing from this node that causes this error, and what can I do about it?

Thanks loads for the help!

asked 21 Feb '18, 10:37

case_the_joint's gravatar image

case_the_joint
11112
accept rate: 0%


I think you want to use the /lookup method since you're not supplying a lat,lon in the search. https://nominatim.openstreetmap.org/lookup?osm_ids=R6265959&format=json

When you do a forward search https://nominatim.openstreetmap.org/search?q=M%C3%A9rida&countrycodes=mx you'll note that Nominatim uses the city relation (https://www.openstreetmap.org/relation/5961522), not the city node (https://www.openstreetmap.org/node/269908858).

What's missing from this node

Nothing. The relation has a Node Mérida (269908858) as admin_centre set. For Nominatim that means both describe the same place. Nominatim chooses to ignore the node in this case.

permanent link

answered 21 Feb '18, 11:06

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

edited 21 Feb '18, 13:27

1

Hi @mtmail thanks so much for the quick response and advice. I forget why I used the reverse and not the lookup. For completeness' sake, the lookup has a slightly different syntax than you suggest:

https://nominatim.openstreetmap.org/lookup?osm_ids=R6265959&format=json

So if I wanted to get a set of coordinates for the Merida node itself, and Nominatim won't return that, then is the best substitute I can get from OSM the centre point of the Merida relation (5961522)?

(21 Feb '18, 11:28) case_the_joint
1

You're right, thanks, I updated the URL in my answer. For a relation result Nominatim tries to use the linked admin_center or admin_label roles (nodes) to set the center. So it knows about those nodes just merges the information. For example for "Hamburg" (the state, https://www.openstreetmap.org/relation/62782) which is split into two parts it returns the center point of the admin_center not the geographic center https://nominatim.openstreetmap.org/lookup.php?osm_ids=R62782 because that wouldn't even be inside the relation/multi-polygon.

(21 Feb '18, 13:37) mtmail

Thanks for the clarification! You've been very helpful, thank you.

(21 Feb '18, 15:58) case_the_joint

Follow this question

By Email:

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

By RSS:

Answers

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:

×689
×293
×205
×85

question asked: 21 Feb '18, 10:37

question was seen: 5,601 times

last updated: 21 Feb '18, 15:58

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum