]> git.openstreetmap.org Git - nominatim.git/commitdiff
Parameterise the search only within countries
authoralfmarcua <alfmarcua@gmail.com>
Thu, 6 Jul 2023 06:52:41 +0000 (08:52 +0200)
committeralfmarcua <alfmarcua@gmail.com>
Wed, 12 Jul 2023 11:53:23 +0000 (13:53 +0200)
lib-php/ReverseGeocode.php
nominatim/tools/refresh.py
settings/env.defaults

index fddad60dca19d77b2f1433808b52189d007be34e..1777288afaff69937fcc2fcc4495f311a6b97583 100644 (file)
@@ -85,6 +85,11 @@ class ReverseGeocode
 
     protected function lookupLargeArea($sPointSQL, $iMaxRank)
     {
+        if(CONST_Search_WithinCountries
+            and $this->lookupInCountry($sPointSQL, $iMaxRank) == null){
+                return  null;
+        }
+
         if ($iMaxRank > 4) {
             $aPlace = $this->lookupPolygon($sPointSQL, $iMaxRank);
             if ($aPlace) {
index c6df9982bd6109f4a8ba907989ed96e0ea165604..43e5b1eb387a4641ef49274bc63eaa485c171eda 100644 (file)
@@ -120,6 +120,7 @@ PHP_CONST_DEFS = (
     ('Search_NameOnlySearchFrequencyThreshold', 'SEARCH_NAME_ONLY_THRESHOLD', str),
     ('Use_US_Tiger_Data', 'USE_US_TIGER_DATA', bool),
     ('MapIcon_URL', 'MAPICON_URL', str),
+    ('Search_WithinCountries', 'SEARCH_WITHIN_COUNTRIES', bool),
 )
 
 
index f9f590da65fb50156d1f3139403d7a9cba4a59c6..c4739e786cdd95aa145d0c0172e949b11bb3433d 100644 (file)
@@ -214,6 +214,12 @@ NOMINATIM_SERVE_LEGACY_URLS=yes
 # of connections _per worker_.
 NOMINATIM_API_POOL_SIZE=10
 
+# Search elements just within countries
+# If, despite not finding a point within the static grid of countries, it
+# finds a geometry of a region, do not return the geometry. Return "Unable
+# to geocode" instead.
+NOMINATIM_SEARCH_WITHIN_COUNTRIES=False
+
 ### Log settings
 #
 # The following options allow to enable logging of API requests.