isArea := true;
centroid := ST_Centroid(geometry);
- FOR geometry IN select split_geometry(geometry) as geometry LOOP
- x := insertLocationAreaLarge(partition, place_id, country_code, keywords, rank_search, rank_address, false, centroid, geometry);
+ FOR secgeo IN select split_geometry(geometry) AS geom LOOP
+ x := insertLocationAreaLarge(partition, place_id, country_code, keywords, rank_search, rank_address, false, centroid, secgeo);
END LOOP;
ELSEIF rank_search < 26 THEN
result BOOLEAN;
BEGIN
- IF NEW.indexed_status != 0 OR OLD.indexed_status = 0 THEN
+ IF NEW.indexed_status != 0 OR OLD.indexed_status = 0 OR NEW.linked_place_id is not null THEN
RETURN NEW;
END IF;
RETURN NEW;
END IF;
- IF OLD.indexed_status > 1 THEN
+ IF OLD.indexed_status > 0 THEN
result := deleteSearchName(NEW.partition, NEW.place_id);
DELETE FROM place_addressline WHERE place_id = NEW.place_id;
DELETE FROM place_boundingbox where place_id = NEW.place_id;
b BOOLEAN;
classtable TEXT;
BEGIN
- RAISE WARNING 'placex_delete % %',OLD.osm_type,OLD.osm_id;
+ -- RAISE WARNING 'placex_delete % %',OLD.osm_type,OLD.osm_id;
update placex set linked_place_id = null where linked_place_id = OLD.place_id;
--DEBUG: RAISE WARNING 'placex_delete:01 % %',OLD.osm_type,OLD.osm_id;
--DEBUG: RAISE WARNING 'delete: % % % %',OLD.osm_type,OLD.osm_id,OLD.class,OLD.type;
- -- deleting large polygons can have a massive effect ont he system - require manual intervention to let them through
- IF st_area(OLD.geometry) > 2 THEN
+ -- deleting large polygons can have a massive effect on the system - require manual intervention to let them through
+ IF st_area(OLD.geometry) > 2 and st_isvalid(OLD.geometry) THEN
insert into import_polygon_delete values (OLD.osm_type,OLD.osm_id,OLD.class,OLD.type);
RETURN NULL;
END IF;
IF st_intersects(geometry, secbox) THEN
secgeo := st_intersection(geometry, secbox);
IF NOT ST_IsEmpty(secgeo) AND ST_GeometryType(secgeo) in ('ST_Polygon','ST_MultiPolygon') THEN
- FOR geo IN select quad_split_geometry(secgeo, maxarea, remainingdepth) as geometry LOOP
- IF NOT ST_IsEmpty(geo.geometry) AND ST_GeometryType(geo.geometry) in ('ST_Polygon','ST_MultiPolygon') THEN
+ FOR geo IN select quad_split_geometry(secgeo, maxarea, remainingdepth) as geom LOOP
+ IF NOT ST_IsEmpty(geo.geom) AND ST_GeometryType(geo.geom) in ('ST_Polygon','ST_MultiPolygon') THEN
added := added + 1;
- RETURN NEXT geo.geometry;
+ RETURN NEXT geo.geom;
END IF;
END LOOP;
END IF;
geo RECORD;
BEGIN
-- 10000000000 is ~~ 1x1 degree
- FOR geo IN select quad_split_geometry(geometry, 0.25, 20) as geometry LOOP
- RETURN NEXT geo.geometry;
+ FOR geo IN select quad_split_geometry(geometry, 0.25, 20) as geom LOOP
+ RETURN NEXT geo.geom;
END LOOP;
RETURN;
END;