X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/8a796db3c974c55de8d59f3682a149e3642e6952..e171f90d81cb1a21eb6cda537a68b338052f2bce:/utils/query.php diff --git a/utils/query.php b/utils/query.php old mode 100755 new mode 100644 index a3f51f74..f8047ffc --- a/utils/query.php +++ b/utils/query.php @@ -1,55 +1,47 @@ -#!/usr/bin/php -Cq connect(); - if ($oParams->getBool('search')) - { - if (isset($aCMDResult['nodedupe'])) $aCMDResult['dedupe'] = 'false'; +$oParams = new Nominatim\ParameterParser($aCMDResult); - $oGeocode = new Geocode($oDB); +if ($oParams->getBool('search')) { + if (isset($aCMDResult['nodedupe'])) $aCMDResult['dedupe'] = 'false'; - $oGeocode->setLanguagePreference($oParams->getPreferredLanguages(false)); - $oGeocode->loadParamArray($oParams); - $oGeocode->setQuery($aCMDResult['search']); - - $aSearchResults = $oGeocode->lookup(); - - if (version_compare(phpversion(), "5.4.0", '<')) - echo json_encode($aSearchResults); - else - echo json_encode($aSearchResults, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)."\n"; - } - else - { - showUsage($aCMDOptions, true); - } + $oGeocode = new Nominatim\Geocode($oDB); + $oGeocode->setLanguagePreference($oParams->getPreferredLanguages(false)); + $oGeocode->loadParamArray($oParams); + $oGeocode->setQuery($aCMDResult['search']); + $aSearchResults = $oGeocode->lookup(); + echo json_encode($aSearchResults, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)."\n"; +} else { + showUsage($aCMDOptions, true); +}