- $sSQL = 'select place_id,parent_place_id,rank_search from placex';
- $sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', geometry, '.$fSearchDiam.')';
- $sSQL .= ' and rank_search != 28 and rank_search >= '.$iMaxRank;
- $sSQL .= ' and (name is not null or housenumber is not null)';
- $sSQL .= ' and class not in (\'waterway\',\'railway\',\'tunnel\',\'bridge\')';
- $sSQL .= ' and (ST_GeometryType(geometry) not in (\'ST_Polygon\',\'ST_MultiPolygon\') ';
- $sSQL .= ' OR ST_DWithin('.$sPointSQL.', ST_Centroid(geometry), '.$fSearchDiam.'))';
- $sSQL .= ' ORDER BY ST_distance('.$sPointSQL.', geometry) ASC limit 1';
-//var_dump($sSQL);
- $aPlace = $oDB->getRow($sSQL);
- if (PEAR::IsError($aPlace))
- {
- failInternalError("Could not determine closest place.", $sSQL, $iPlaceID);
- }
- $iPlaceID = $aPlace['place_id'];
- $iParentPlaceID = $aPlace['parent_place_id'];
- }
+ if ($aLookup)
+ {
+ $oPlaceLookup = new PlaceLookup($oDB);
+ $oPlaceLookup->setLanguagePreference($aLangPrefOrder);
+ $oPlaceLookup->setIncludeAddressDetails(getParamBool('addressdetails', true));
+ $oPlaceLookup->setIncludeExtraTags(getParamBool('extratags', false));
+ $oPlaceLookup->setIncludeNameDetails(getParamBool('namedetails', false));