X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/110491011f8a796ca5f6d78208c148afd89d1ba0..ccb5cf155db45283377b44dcc0df63bfbe438168:/lib-sql/functions/utils.sql?ds=sidebyside diff --git a/lib-sql/functions/utils.sql b/lib-sql/functions/utils.sql index a8ebcc41..f8b365c5 100644 --- a/lib-sql/functions/utils.sql +++ b/lib-sql/functions/utils.sql @@ -436,6 +436,20 @@ END; $$ LANGUAGE plpgsql IMMUTABLE; +CREATE OR REPLACE FUNCTION simplify_large_polygons(geometry GEOMETRY) + RETURNS GEOMETRY + AS $$ +BEGIN + IF ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') + and ST_MemSize(geometry) > 3000000 + THEN + geometry := ST_SimplifyPreserveTopology(geometry, 0.0001); + END IF; + RETURN geometry; +END; +$$ +LANGUAGE plpgsql IMMUTABLE; + CREATE OR REPLACE FUNCTION place_force_delete(placeid BIGINT) RETURNS BOOLEAN