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

Hi,

I'm new to OpenStreetMap so forgive me if this is a naive question. I am exploring the use of the Nominatim service/API and notice that for the Bay Area of California the city names are completely wrong.

For example, when I specify the location of the Marriott in Downtown San Jose and do a nominatim lookup:

http://nominatim.openstreetmap.org/reverse?format=xml&lat=37.330144&lon=-121.889052&zoom=18&addressdetails=1

I get back:

<addressparts>
<hotel>Marriott</hotel>
<road>South Market Street</road>
<city>Santa Clara</city>
<county>Santa Clara County</county>
<state>California</state>
<postcode>95113</postcode>
<country>United States of America</country>
<country_code>us</country_code>
</addressparts>

Everything is absolutely correct except for the city name, which should be San Jose.

Similarly, picking the lat/long of the oval park on Stanford's Campus I get a similar wrong city name.

http://nominatim.openstreetmap.org/reverse?format=xml&lat=37.429806&lon=-122.169491&zoom=18&addressdetails=1
<addressparts>
<common>The Oval Park</common>
<road>Palm Drive</road>
<place>Southgate</place>
<city>Santa Clara</city>
<county>Santa Clara County</county>
<state>California</state>
<postcode>94305-6072</postcode>
<country>United States of America</country>
<country_code>us</country_code>
</addressparts>

In all the cases that I've tested, it seems that the county name is being incorrectly used for the city. I'm not sure if this is an OSM data problem, or a logic problem with Nominatim.

Any help on how to get this resolved would be very much appreciated.

asked 26 Oct '12, 17:52

JBiehl's gravatar image

JBiehl
41115
accept rate: 0%

edited 25 Nov '13, 15:40

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554

I've been investigating this on my own for a bit, and I'm at a loss for why Nominatim is still returning the wrong city names for the reverse queries.

As folks suggested on this post, all the cities where this is an issue DO have relations to represent the administrative boundaries, and those relations seem to be properly labeled (as do the ways). I have compared the relations for the cities in the Bay Area to those in other part of California where Nominatim DOES get the city names right, and I can't tell any difference.

If anyone could help identify what is going on I'd be very appreciative. We'd like to use this service in a project, but if the data is not accurate we'll unfortunately have to look at the commercial options.

(05 Nov '12, 03:42) JBiehl
1

Thanks for the responses.

I have two additional questions:

1) How long does it take for changes to a relation to propagate to Nominatim? Seems like even after a few days the changes are not reflected.

2) I still think that something else is going on with the data. Forget San Jose for the moment (because Nominatim still thinks the relation is broken). Take the Los Altos Post Office:

http://nominatim.openstreetmap.org/details.php?place_id=3431300

As you can see from the details, Nominatim is finding the Los Altos Administrative Boundary (which is a correct/valid relation), but is still identifying it's city as Santa Clara (which should obviously be Los Altos).

Thanks in advance for any insight into what is going on here.

(09 Nov '12, 06:02) JBiehl
1

At first glance the above seems like something going wrong with nominatim. Will investigate.

(09 Nov '12, 10:31) twain

Did the issue in Nominatim get addressed?

(28 Nov '12, 23:16) JBiehl

I'm running Nominatim 2.1 and I noticed several locations with wrong city names as well. For one, I live in Fremont (Alameda County). There's also a city named Alameda, which is located 30+ miles north of Fremont. Reverse-geocoding my home's coordinates says my home is in City: Alameda, County: Alameda Country.

(04 Nov '13, 19:27) baekacaek

@baekacaek without sample coordinates that show the issue (best the query itself) it is difficult to help. But first thing to check is if the OSMF nominatim instance returns the same result.

(05 Nov '13, 11:29) SimonPoole ♦

@SimonPoole I opened another question with two examples, one where the city is wrong (both my nominatim and OSM), and two where city is wrong and inconsistent with OSM (my nominatim wrong, but OSM right). https://help.openstreetmap.org/questions/28784/nominatim-returning-wrong-city-names

(04 Dec '13, 19:56) baekacaek
showing 5 of 7 show 2 more comments

You are probably best off creating the boundary using a relation which is documented here: http://wiki.openstreetmap.org/wiki/Relation:boundary

If you want you can link the previous node as a 'label' relation member - which is an advantage of using a relation since it allow you to define the exact centre as well as the outline.

You may find this help topic useful although it relates to editing an existing boundary rather than adding a new one: https://help.openstreetmap.org/questions/13858/how-do-i-correct-an-administrative-boundary-in-the-nominatim

I generally find this sort of editing easier to do in JOSM rather than potlatch but I belive it is possible in either.

permanent link

answered 27 Oct '12, 00:07

twain's gravatar image

twain
2.4k2538
accept rate: 40%

1

So it turns out there is a relation that defines the city:

http://www.openstreetmap.org/browse/relation/112143

It looks closed to me, so I'm wondering why this relation is not used to define the city in the nominatim query. Perhaps it's missing required tags?

Thanks for all the help -- this forum is great.

(27 Oct '12, 01:21) JBiehl
3

I've investigated relation 112143. From the nominatim database:

nominatim=# select st_isvalid(geometry) from place where osm_type = 'R' and osm_id = 112143; NOTICE: Self-intersection at or near point -121.80706582236448 37.369616207441474

i.e.: http://www.openstreetmap.org/?lat=37.369616207441474&lon=-121.80706582236448&zoom=18&layers=M&relation=112143

The error is so small you can't really see it at zoom 18. Try JOSM.

Unfortunately none of the standard relation tools seem to pick this up as an error! I'll see if I can get something added to nominatim to allow these to be found.

(05 Nov '12, 13:35) twain

Wow! That is small! Nice catch. In the meantime should I correct the error? Or leave it as a test condition for your modification?

(05 Nov '12, 18:44) JBiehl
1

You can find self-intersecting ways with the OSM Inspector. After you've found them, you can fix them. Nominatim isn't the only tool that doesn't like these errors.

(05 Nov '12, 19:18) cartinus
(05 Nov '12, 19:27) cartinus
2

You can now also see polygon problems from within nominatim:

http://nominatim.openstreetmap.org/details?osmtype=R&osmid=112143

The details page shows how nominatim interpreted the openstreetmap data for that feature.

(07 Nov '12, 23:49) twain
showing 5 of 6 show 1 more comments
-1

Has anyone considered that the most simple way to "fix" this problem shoudl be to give the Marriott address data of some sort? It doesn't even have a street number!

permanent link

answered 06 Nov '12, 17:45

Circeus's gravatar image

Circeus
58391426
accept rate: 7%

1

Adding the full address would probably lead to the correct city name being returned but doesn't fix the actual problem.

(06 Nov '12, 18:05) scai ♦
1

That fixes one address - not any of the other roads/houses nearby. Fixing the relation fixes all of them.

(06 Nov '12, 18:06) twain

If you search for South Market Street, Santa Clara County you will see two results, the first belongs to Santa Clara and the second one to San José. Opening the details for the first result reveals that Santa Clara is only a node, likewise the details of the second result show that San José is also just a node. Now, how should Nominatim know which map feature in this region belongs to Santa Clara and which belongs to San José? It can't without having a border for those two cities and consequently it tries to estimate the borders. The solution is to add both cities as an area instead of a node.

permanent link

answered 26 Oct '12, 18:09

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

1

Excellent explanation. Is this something I can change using Potlatch2? If so, can someone provide a pointer to a tutorial for editing/setting city areas?

(26 Oct '12, 18:29) JBiehl
1

Yes, just draw a closed way (that's an area in OSM) and add all the tags from the city node to the area.

(26 Oct '12, 18:34) scai ♦
1

OK - looking closer it seems that there are fragments of TIGER bounding lines, they just aren't connected, and thus don't form a closed way. I tried using Potlatch to "link" the appropriate ways together, but I soon encountered this issue:

A server error occurred. Do you want to retry? (The server said: You tried to add 2498 nodes to way 38549944, however only 2000 are allowed.

Anyway around this?

(26 Oct '12, 23:39) JBiehl
1

@JBiehl: For technical reasons, you cannot add too many nodes to a single way, thus the error. You probably need to use a "relation", see twain's answer.

(27 Oct '12, 14:28) sleske
1

Yes -- Relation is the way to do it. I revoked my original changes and started to make a relation. However, it seems that one already exists for the city: http://www.openstreetmap.org/browse/relation/112143

What I don't understand is why this is not being using to return the proper city name in the nominatim reverse query?

(29 Oct '12, 16:47) JBiehl
Your answer
toggle preview

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
×107
×85

question asked: 26 Oct '12, 17:52

question was seen: 9,733 times

last updated: 04 Dec '13, 19:56

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