Open lonvia opened 2 days ago
When assigning a country code from location_area_country, there is no special ordering in the query:
https://github.com/osm-search/Nominatim/blob/b63633857ed4c9af7af6f35054569dc79c6cc5a0/lib-sql/functions/utils.sql#L173-L178
This means that the result is essentially random where multiple countries overlap. The fallback code does ordering by area:
https://github.com/osm-search/Nominatim/blob/b63633857ed4c9af7af6f35054569dc79c6cc5a0/lib-sql/functions/utils.sql#L184-L189
This may not end us with a correct result but at least with a consistent one. The area is not easily available in location_area_country.
Some ideas:
When assigning a country code from location_area_country, there is no special ordering in the query:
https://github.com/osm-search/Nominatim/blob/b63633857ed4c9af7af6f35054569dc79c6cc5a0/lib-sql/functions/utils.sql#L173-L178
This means that the result is essentially random where multiple countries overlap. The fallback code does ordering by area:
https://github.com/osm-search/Nominatim/blob/b63633857ed4c9af7af6f35054569dc79c6cc5a0/lib-sql/functions/utils.sql#L184-L189
This may not end us with a correct result but at least with a consistent one. The area is not easily available in location_area_country.
Some ideas: