Opened 9 years ago

Closed 5 years ago

#3950 closed defect (worksforme)

Nominatim reverse geocoding bug (missing ST_Centroid in query)

Reported by: rukus Owned by: geocoding@…
Priority: minor Milestone:
Component: nominatim Version:
Keywords: Cc:


I found that in one case http://localhost/~seth/reverse?format=xml&lat=49.989675&lon=36.206152&zoom=18&addressdetails=1 nominatim returns street that is far away of specified place. Looking into sources i found that in reverse.php if ($iMaxRank >= 26)


Street level search is done using placex table $sSQL = 'select place_id from placex'; $sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', geometry, '.$fSearchDiam.')'; $sSQL .= ' and rank_search >= 26 and rank_search <= '.$iMaxRank; $sSQL .= ' and (ST_GeometryType(geometry) not in (\'ST_Polygon\',\'ST_MultiPolygon\') ';

$sSQL .= ' OR ST_DWithin('.$sPointSQL.', ST_Centroid(geometry), '.$fSearchDiam.'))';

$sSQL .= ' and rank_address != 0 and type != \'houses\; if ($bNamedOnly) $sSQL .= ' and (name is not null or housenumber is not null)'; $sSQL .= ' ORDER BY rank_search desc, ST_distance('.$sPointSQL.', geometry) ASC limit 1';

is using geometry instead of ST_Centroid(geometry). So the last string should be updated to

$sSQL .= ' ORDER BY rank_search desc, ST_distance('.$sPointSQL.', ST_Centroid(geometry)) ASC limit 1';

Change History (3)

comment:1 Changed 9 years ago by Tom Hughes

Component: adminnominatim
Owner: changed from Tom Hughes to openstreetmap@…
Priority: criticalminor

comment:2 Changed 8 years ago by Tom Hughes

Owner: changed from openstreetmap@… to geocoding@…

comment:3 Changed 5 years ago by Sarah Hoffmann

Resolution: worksforme
Status: newclosed

Reverse implementation has been changed in the meantime. Closing.

Note: See TracTickets for help on using tickets.