OSM reverse Geo lookup sometimes provides inaccurate results.

I’ve been occasionally playing with OSM api and for the most part it works pretty good. However every now and then I come across coordinates that OSM responds with a result but when I look at the bounding rect for the coordinates I provided, they do not fall in the bounding rect. A closer look at the response packet provided by OSM reveals that the coordinates in the response packet are slightly different than the one I had provided and they do fall in the bounding rect.

Is this normal handling by OSM to provide the closest matching result ? or am I doing something wrong.

Here is an example of the API call I made which provides incorrect result:

https://nominatim.openstreetmap.org/reverse?format=json&lat=40.571128&lon=-74.339438

I think this is best raised on GitHub for the project.

Note that what you’re using is Nominatim, not the OSM API. They’re two very different things: one is a geocoder, the other is for editing the OSM database.