truely ignore country codes provided via tags

This commit is contained in:
Sarah Hoffmann 2014-03-25 23:52:07 +01:00
parent c2417dd1c4
commit f6c7c4fcef

View File

@ -554,20 +554,6 @@ END;
$$ $$
LANGUAGE plpgsql IMMUTABLE; LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION get_country_code(place geometry, in_country_code VARCHAR(2)) RETURNS TEXT
AS $$
DECLARE
nearcountry RECORD;
BEGIN
FOR nearcountry IN select country_code from country_name where country_code = lower(in_country_code)
LOOP
RETURN nearcountry.country_code;
END LOOP;
RETURN get_country_code(place);
END;
$$
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION get_country_language_code(search_country_code VARCHAR(2)) RETURNS TEXT CREATE OR REPLACE FUNCTION get_country_language_code(search_country_code VARCHAR(2)) RETURNS TEXT
AS $$ AS $$
DECLARE DECLARE
@ -965,7 +951,7 @@ BEGIN
NEW.place_id := nextval('seq_place'); NEW.place_id := nextval('seq_place');
NEW.indexed_status := 1; --STATUS_NEW NEW.indexed_status := 1; --STATUS_NEW
NEW.calculated_country_code := lower(get_country_code(NEW.geometry, NEW.country_code)); NEW.calculated_country_code := lower(get_country_code(NEW.geometry));
NEW.partition := get_partition(NEW.geometry, NEW.calculated_country_code); NEW.partition := get_partition(NEW.geometry, NEW.calculated_country_code);
NEW.geometry_sector := geometry_sector(NEW.partition, NEW.geometry); NEW.geometry_sector := geometry_sector(NEW.partition, NEW.geometry);
@ -1358,7 +1344,6 @@ BEGIN
-- reclaculate country and partition -- reclaculate country and partition
IF NEW.rank_search >= 4 THEN IF NEW.rank_search >= 4 THEN
--NEW.calculated_country_code := lower(get_country_code(NEW.geometry, NEW.country_code));
NEW.calculated_country_code := lower(get_country_code(place_centroid)); NEW.calculated_country_code := lower(get_country_code(place_centroid));
ELSE ELSE
NEW.calculated_country_code := NULL; NEW.calculated_country_code := NULL;