]> git.openstreetmap.org Git - nominatim.git/commitdiff
handle 'order state level queries better
authorBrian Quinion <openstreetmap@brian.quinion.co.uk>
Mon, 23 May 2011 16:12:54 +0000 (16:12 +0000)
committerBrian Quinion <openstreetmap@brian.quinion.co.uk>
Mon, 23 May 2011 16:12:54 +0000 (16:12 +0000)
website/search.php

index 6b49241452ff3b275b984029dc5da76c577aeae2..fc03a58d7fbaf243f702bb6d1b688b216698d878 100755 (executable)
                                                                                if ($sCountryCodesSQL) $sSQL .= " and lp.country_code in ($sCountryCodesSQL)";
                                                                                if ($sNearPointSQL) $sSQL .= " order by ST_Distance($sNearPointSQL, l.centroid) ASC";
                                                                                else if ($sPlaceIDs) $sSQL .= " order by ST_Distance(l.centroid, f.geometry) asc";
                                                                                if ($sCountryCodesSQL) $sSQL .= " and lp.country_code in ($sCountryCodesSQL)";
                                                                                if ($sNearPointSQL) $sSQL .= " order by ST_Distance($sNearPointSQL, l.centroid) ASC";
                                                                                else if ($sPlaceIDs) $sSQL .= " order by ST_Distance(l.centroid, f.geometry) asc";
+                                                                               else if ($sPlaceGeom) $sSQL .= " order by ST_Distance(st_centroid('".$sPlaceGeom."'), l.centroid) asc";
+                                                               
                                                                                $sSQL .= " limit $iLimit";
                                                                                if (CONST_Debug) var_dump($sSQL);
                                                                                $aPlaceIDs = $oDB->getCol($sSQL);
                                                                                $sSQL .= " limit $iLimit";
                                                                                if (CONST_Debug) var_dump($sSQL);
                                                                                $aPlaceIDs = $oDB->getCol($sSQL);