diff --git a/layers/place/update_city_point.sql b/layers/place/update_city_point.sql index 6795e267..2e02a311 100644 --- a/layers/place/update_city_point.sql +++ b/layers/place/update_city_point.sql @@ -20,16 +20,8 @@ BEGIN osm_city_point AS osm WHERE ( (osm.tags ? 'wikidata' AND osm.tags->'wikidata' = ne.wikidataid) OR - ne.name ILIKE osm.name OR - ne.name ILIKE osm.name_en OR - ne.namealt ILIKE osm.name OR - ne.namealt ILIKE osm.name_en OR - ne.meganame ILIKE osm.name OR - ne.meganame ILIKE osm.name_en OR - ne.gn_ascii ILIKE osm.name OR - ne.gn_ascii ILIKE osm.name_en OR - ne.nameascii ILIKE osm.name OR - ne.nameascii ILIKE osm.name_en OR + lower(osm.name) IN (lower(ne.name), lower(ne.namealt), lower(ne.meganame), lower(ne.gn_ascii), lower(ne.nameascii)) OR + lower(osm.name_en) IN (lower(ne.name), lower(ne.namealt), lower(ne.meganame), lower(ne.gn_ascii), lower(ne.nameascii)) OR ne.name = unaccent(osm.name) ) AND osm.place IN ('city', 'town', 'village') diff --git a/layers/water_name/update_marine_point.sql b/layers/water_name/update_marine_point.sql index f04cf19d..bcda7715 100644 --- a/layers/water_name/update_marine_point.sql +++ b/layers/water_name/update_marine_point.sql @@ -16,10 +16,8 @@ BEGIN SELECT osm.geometry, osm.osm_id, osm.name, osm.name_en, ne.scalerank, osm.is_intermittent FROM ne_10m_geography_marine_polys AS ne, osm_marine_point AS osm - WHERE trim(regexp_replace(ne.name, '\\s+', ' ', 'g')) ILIKE osm.name - OR trim(regexp_replace(ne.name, '\\s+', ' ', 'g')) ILIKE osm.tags->'name:en' - OR trim(regexp_replace(ne.name, '\\s+', ' ', 'g')) ILIKE osm.tags->'name:es' - OR osm.name ILIKE trim(regexp_replace(ne.name, '\\s+', ' ', 'g')) || ' %' + WHERE lower(trim(regexp_replace(ne.name, '\\s+', ' ', 'g'))) IN (lower(osm.name), lower(osm.tags->'name:en'), lower(osm.tags->'name:es')) + OR substring(lower(trim(regexp_replace(ne.name, '\\s+', ' ', 'g'))) FROM 1 FOR length(lower(osm.name))) = lower(osm.name) ) UPDATE osm_marine_point AS osm SET "rank" = scalerank