difference between nominatim lookup and osm lookup

I am puzzling over the following:

https://nominatim.openstreetmap.org/lookup?osm_ids=N1271595261 produces no results while
https://www.openstreetmap.org/node/1271595261 gives results - why would this be ? I need to do this programmatically and thus the nominatim is necessary, I believe.

Maybe because this node does not carry any tags? Try it with this one for example:

https://www.openstreetmap.org/node/4360749904
https://nominatim.openstreetmap.org/lookup?osm_ids=N4360749904

yes I suppose that would explain it, thank you

whoops , not so fast :confused:

https://nominatim.openstreetmap.org/lookup?osm_ids=N32870515

and

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

belie this otherwise-alluring explanation

The node is certainly known to Nominatim: https://nominatim.openstreetmap.org/details.php?place_id=194799

I wonder if it has to do with the one node being part of a relation and the other not? Just guessing.

But I seriously wonder how a city can simultaneously be a water tower. https://www.openstreetmap.org/node/32870515

I don’t believe lookup by place id is recommended practice since the placeid can change per installation , iiuc. I am looking for how to get this data doing a node_id lookup - if there is no way to do it then I guess I will give up and use the placeid - anyone know what’s going on ? :frowning:

can someone with the requisite knowledge weigh in here? I seem to be forced to lookup by place id, is this standard practice?

I don’t understand why you ask nominatim when you already know the node id.

What is it you are actually trying to do? If people can understand that they might be able to help.

I am trying to get extra details about certain nodes from nominatim . For instance for cities in south america , I would like details such as containing district, country, altnames, etc.
To get a list of nodes e.g. representing s. america cities I can use osmfilter on the relevant .osm file.
With this list of nodes I can programmatically query nominatim to get the info I am after , to end up with a list of cities and containing districts.

However nominatim (https://nominatim.openstreetmap.org) will in many cases return nothing for a node, while the openstreetmap site (https://www.openstreetmap.org/node/) will at least recognize the node and further show some of the details that I am interested in.

I would like to get the node and extra information usually available from nominatim but am not clear why no results are forthcoming from a simple lookup for many nodes (eg
https://nominatim.openstreetmap.org/lookup?osm_ids=N32870515&addressdetails=1&extratags=1 returns nothing , and
https://nominatim.openstreetmap.org/reverse?osm_type=N&osm_id=32870515&format=json returns ‘unable to geocode’,
while the osm lookup
https://www.openstreetmap.org/node/32870515 returns the node details plus extra information such as is_in info ).

In other cases nominatim does fine, eg.
https://nominatim.openstreetmap.org/lookup?osm_ids=N107775&addressdetails=1&extratags=1

I am looking for the data about the node that nominatim sometimes provides and osm usually provides, for instance within which city/state/country the node resides, alt names, etc.

Risking to state the obvious: The is_in information is not computed, it is a tag of the node added by a mapper.

Yes, the is_in is in the node tags (and is not always provided) ; in this case I misspoke and am looking for the extra computed info ; containing county/district/country etc. (computed information in the style of the is_in tags, namely what objects contain the node) .
There is a fundamental question here , namely why nominatim returns ‘cannot geocode’ for many nodes when using the api node lookup functions (lookup and reverse) . I wonder what is going on behind the scenes at the openstreetmap.org lookup , if it is augmenting nominatim somehow?

I guess that nominatim doesn’t store the information for all nodes in the OSM db, only for those which have a place_id.

It seems to be true.

Node 54 for instance representing the major city Novosibirsk has no place id and thus the nominatim node id search returns nothing. :confused:
I suppose what I need to do for such cases is search by name and area and hope to find other entities (ways/relations) that do have place ids; this is somewhat annoying since then I have to disambiguate the potential multiple results; the nice thing about a node lookup is the node serves as uid.

It seems somewhat more involved than necessary; is there some reason not every node tagged ‘city’ gets the honor of a place id (or alternately why nominatim will not return anything but items with place id?)

Now that i think of it I suppose in my original osmfilter run I should find not only nodes but also ways and relations tagged as city , and perhaps of those at least one will have a place id and thus be found in nominatim.

In any case thanks for your help, this has been useful.

Just in case it might help: In the mkgmap project (1) we compute a file bounds.zip which contains the admin boundaries in a way that allows
to retrieve the wanted information for any position. In mkgmap it is used to fill search indexes.
You can use this functionality to produce a file that contains the osm id and the enclosing boundaries.

Edit: I described this here: https://forum.openstreetmap.org/viewtopic.php?pid=692800#p692800

(1) http://www.mkgmap.org.uk/