osm-search / Nominatim

Open Source search based on OpenStreetMap data
https://nominatim.org
GNU General Public License v3.0
3.23k stars 718 forks source link

Use Voronoi partition within a city without suburb boundaries #1505

Open IgorEliezer opened 5 years ago

IgorEliezer commented 5 years ago

If the city/town doesn't have suburb boundaries, the "Show address" tries to find the nearest neighborhood even if there's two or three suburbs between the queried coordinate and the neighborhood.

image

https://www.openstreetmap.org/search?whereami=1&query=-23.6854%2C-46.5136#map=16/-23.6796/-46.5060

While the city doesn't have boundaries, the query would be better if:

mtmail commented 5 years ago

This is what Nominatim is looking at. First it finds the nearest address (house number or road), then looks up the other places https://nominatim.openstreetmap.org/details?osmtype=W&osmid=155847327

You're right it sorts them by distance. It treats neighborhoods as having a higher rank than suburbs.

What would you think the address should be? I'm trying to see if it's a problem in Nominatim's search or in how it gets displayed on openstreetmap.org website.

IgorEliezer commented 5 years ago

What would you think the address should be?

The issue in the case is that neighborhood Vila Amábile Pezzolo (upper right corner, in green) is way nearer to the suburb Vila Progresso than the suburb Vila Helena, which is quite near to the query. Therefore, I'm proposing the following rule:

For the above, I'm assuming the following:

  1. There's no admin boundaries within the city boundary;
  2. Due to the item 1, Nominatim has to guess subdivision of the city by splitting it mid-distance between place nodes when it searches for the nearest place.
  3. Nominatim considers neighborhood a subdivision of a suburb, since it returns the address in the format "house number, street name, neighborhood, suburb..."

As to the item 2, let me illustrate what I want to mean:

Say the black rectangle below is the city boundary and the black dots are the suburb nodes (A, B, C).

image

Since Nominatim searches for the nearest place, it's safe to assume the city is split into suburb regions like this:

image

Now let's add a neighborhood within the suburb C, the neighborhood C1.

image

Assume 3 queries, Q1, Q2 and Q3:

image

As you can see here, it's sensible to say the Q1 should return something like house number, street name, suburb A, city name and should ignore neighborhood C1 since it's part of suburb C and far away, nearer to the suburb C than the suburb A.

Q2 and Q3 could return house number, street name, neighborhood C1, suburb C, city name. But I would prefer that only Q3 should have neighborhood C1 if we also assume suburb C can be split mid-distance between C and C1 by the same "search nearest place node" method.

image

Bibi56 commented 5 years ago

I was about to create a ticket, but this one is pretty much describing my issue. If I do a search for L'estran, Guidel it returns Théâtre L'Estran, Rue Général De Gaulle, Kerlann, Guidel, Lorient, Morbihan, Bretagne, France métropolitaine, 56520, France.

Kerlann is an isolated dwelling, outside the residential area. As it's an isolated dwelling the place name validity is just a few 10 m big.

Kerprat is a hamlet closer (that's the correct answer BTW) and Le Prat can't be an option as it has a delimited boundary (not an admin one).

Update: I described Les Jardins de Vitalis as relation - it was a node and now I get: L'Estran, Rue Général De Gaulle, Les Jardins de Vitalis, Kerlann, Guidel, Lorient, Morbihan, Bretagne, France métropolitaine, 56520, France. Bad as L'Estran is outside the contour of Les Jardins de Vitalis. If you want to describe it, it's "near Les Jardins de Vitalis".

Let me know if you prefer a separated ticket.

lonvia commented 4 years ago

What you are actually proposing is that Nominatim should split up the city in a Voronoi diagram. That would be nice to do but unfortunately is more complicated than just computing the distance to the closest neighbourhood and suburb point.

IgorEliezer commented 4 years ago

What you are actually proposing is that Nominatim should split up the city in a Voronoi diagram.

My point is that it doesn't make much sense to return as an address component a quite far neighborhood when the map has two or more suburbs between the queried point and the closest neighborhood. Diagrams above were illustrative.

image

As can be seen in the above diagram, it is quite unlikely that the Neighborhood1 is part of the Suburb1 while there are other two or more suburbs between them, unless a mapper explicitly draws a panhandle boundary involving both the Suburb1 and Neighborhood1.

While a mapper doesn't draw the boundaries, the best approach would be to assume that Neighborhood1 is rather part of Suburb3 than Suburb1, because Neighborhood1 is closer to Suburb3 than Suburb1. If so, Nominatim should drop Neighborhood1 as address component for the queried point.

If Nominatim can measure distantes and azimuths, it could check if between the closest neighborhood and the queried point, there are more than one closer suburb.

Bibi56 commented 4 years ago

While a mapper doesn't draw the boundaries,

According to the principle Fuck In Fuck Out...: in such edge case, you should draw the boundaries. Don't ask Nominatim to make a good guess when the needed information is missing. But right now, Nominatim doesn't use the boundaries :-( as I mentioned in my previous comment.

lonvia commented 4 years ago

@Bibi56 Nominatim uses the boundaries but addresses are based on streets not address points. That's why you get a different result than expected. It's a separate issue and an already well known one (#328).

IgorEliezer commented 4 years ago

According to the principle Fuck In Fuck Out...: in such edge case, you should draw the boundaries

A mapper should draw the boundaries if 1) the boundary officially exists, and 2) he has the data available and suitable to add in the map. In many cases the mapper knows the place exists but he doesn't have access to the sub-city level boundaries for many reasons -- the city hall is too poor or negligent to make district/suburb boundaries publicly available, or the city hall simply hasn't established any, both cases are pretty common in underdeveloped countries --, so the mapper just adds a node with place tag, as per wiki.

In short, I'm not asking Nominatim to draw boundaries, but to compare distantes between places.

Bibi56 commented 4 years ago

In short, I'm not asking Nominatim to draw boundaries, but to compare distantes between places.

@IgorEliezer, I'm not either, I'm saying if the boundaries exist, they should be used. And @lonvia addressed this issue. I mean my remark, not your ticket as a whole. For Voronoi partition, extra care should be taken for existing boundaries (just use them) and to the importance of the place: if you're 500 m away from a node place=town or a node place=isolated_dwelling it's not the same!

so the mapper just adds a node with place tag, as per wiki.

No, areas and relations are also valid for places. Nodes are more common but it's not incorrect to map it better.