Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Nominatim reverse geocoding bug (missing ST_Centroid in query) #3950

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 1 comment
Closed

Comments

@openstreetmap-trac
Copy link

Reporter: rukus
[Submitted to the original trac issue database at 1.22pm, Wednesday, 3rd August 2011]

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';
@openstreetmap-trac
Copy link
Author

Author: lonvia
[Added to the original trac issue at 8.38pm, Wednesday, 4th February 2015]

Reverse implementation has been changed in the meantime. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant