X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/36b1660121a9261998a2b36cff741587ce5b3c5b..5b02cd22b9d9bdf9d3cd32d9e4cfcb971a92c606:/lib-sql/functions/utils.sql 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