X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4e6c75040e0deaabba44e86bb87c80e176a06896..4f86a91d6141b36a269967dc34ad65f4e8b1dfe5:/lib/lib.php?ds=inline diff --git a/lib/lib.php b/lib/lib.php index cb599ae8..8a49761b 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -116,25 +116,6 @@ function getTokensFromSets($aSets) } -function gbPostcodeCalculate($sPostcode, $sPostcodeSector, $sPostcodeEnd, &$oDB) -{ - // Try an exact match on the gb_postcode table - $sSQL = 'select \'AA\', ST_X(ST_Centroid(geometry)) as lon,ST_Y(ST_Centroid(geometry)) as lat from gb_postcode where postcode = \''.$sPostcode.'\''; - $aNearPostcodes = chksql($oDB->getAll($sSQL)); - - if (sizeof($aNearPostcodes)) { - $aPostcodes = array(); - foreach ($aNearPostcodes as $aPostcode) { - $aPostcodes[] = array('lat' => $aPostcode['lat'], 'lon' => $aPostcode['lon'], 'radius' => 0.005); - } - - return $aPostcodes; - } - - return false; -} - - function getClassTypes() { return array( @@ -516,7 +497,7 @@ function _debugDumpGroupedSearches($aData, $aTokens) echo "
rank | Name Tokens | Name Not | "; echo "Address Tokens | Address Not | country | "; - echo "operator | class | type | house# | "; + echo "operator | class | type | postcode | house# | "; echo "Lat | Lon | Radius | ".$aRow['sClass']." | "; echo "".$aRow['sType']." | "; + echo "".$aRow['sPostcode']." | "; echo "".$aRow['sHouseNumber']." | "; - echo "".$aRow['fLat']." | "; - echo "".$aRow['fLon']." | "; + if ($aRow['oNear']) { + echo "".$aRow['oNear']->lat()." | "; + echo "".$aRow['oNear']->lon()." | "; + } else { + echo ""; + } echo " | ".$aRow['fRadius']." | "; echo ""; @@ -631,10 +617,10 @@ function geometryText2Points($geometry_as_text, $fRadius) // preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/', $aMatch[1], $aPolyPoints, PREG_SET_ORDER); // - } elseif (preg_match('#MULTIPOLYGON\\(\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch)) { +/* } elseif (preg_match('#MULTIPOLYGON\\(\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch)) { // preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/', $aMatch[1], $aPolyPoints, PREG_SET_ORDER); - // + */ } elseif (preg_match('#POINT\\((-?[0-9.]+) (-?[0-9.]+)\\)#', $geometry_as_text, $aMatch)) { // $aPolyPoints = createPointsAroundCenter($aMatch[1], $aMatch[2], $fRadius);
---|