better fallback for address component names (avoid labeling mutliple values 'boundary') and handle situation where a place doesn't have a valid name tag for fallback.

This commit is contained in:
Brian Quinion
2012-12-12 02:09:18 +00:00
parent c98e59be03
commit ad89c1f0ca
2 changed files with 28 additions and 10 deletions

View File

@@ -571,6 +571,20 @@ END;
$$
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION get_country_language_codes(search_country_code VARCHAR(2)) RETURNS TEXT[]
AS $$
DECLARE
nearcountry RECORD;
BEGIN
FOR nearcountry IN select country_default_language_codes from country_name where country_code = search_country_code limit 1
LOOP
RETURN lower(nearcountry.country_default_language_codes);
END LOOP;
RETURN NULL;
END;
$$
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION get_partition(place geometry, in_country_code VARCHAR(10)) RETURNS INTEGER
AS $$
DECLARE
@@ -2157,7 +2171,9 @@ BEGIN
END IF;
END LOOP;
RETURN null;
-- anything will do as a fallback - just take the first name type thing there is
search := avals(name);
RETURN search[1];
END;
$$
LANGUAGE plpgsql IMMUTABLE;