- FOR linkedPlacex IN SELECT * FROM find_linked_place(NEW) LOOP
- -- If we don't already have one use this as the centre point of the geometry
- IF NEW.centroid IS NULL THEN
- --DEBUG: RAISE WARNING 'Linked %', linkedPlacex;
- NEW.centroid := coalesce(linkedPlacex.centroid,
- ST_Centroid(linkedPlacex.geometry));
- END IF;
- place_centroid := NEW.centroid;
-
- -- merge in the label name, re-init word vector
- IF NOT linkedPlacex.name IS NULL THEN
- NEW.name := linkedPlacex.name || NEW.name;
- name_vector := array_merge(name_vector, make_keywords(linkedPlacex.name));
-
- -- Place might have had only a name tag before but has now received
- -- translations from the linked place. Make sure a name tag for the
- -- default language exists in this case.
- IF array_upper(akeys(NEW.name), 1) > 1 THEN
- default_language := get_country_language_code(NEW.country_code);
- IF default_language IS NOT NULL THEN
- IF NEW.name ? 'name' AND NOT NEW.name ? ('name:'||default_language) THEN
- NEW.name := NEW.name || hstore(('name:'||default_language), (NEW.name -> 'name'));
- ELSEIF NEW.name ? ('name:'||default_language) AND NOT NEW.name ? 'name' THEN
- NEW.name := NEW.name || hstore('name', (NEW.name -> ('name:'||default_language)));
- END IF;
- END IF;
- END IF;
+ -- Use this as the centre point of the geometry
+ NEW.centroid := coalesce(location.centroid,
+ ST_Centroid(location.geometry));
+
+ -- merge in the label name
+ IF NOT location.name IS NULL THEN
+ NEW.name := location.name || NEW.name;