forked from hans/Nominatim
reduce precision of computed centroids to 7 digits
This commit is contained in:
@@ -780,7 +780,7 @@ BEGIN
|
||||
SELECT count(*)>0 FROM pg_tables WHERE tablename = classtable and schemaname = current_schema() INTO result;
|
||||
IF result THEN
|
||||
EXECUTE 'INSERT INTO ' || classtable::regclass || ' (place_id, centroid) VALUES ($1,$2)'
|
||||
USING NEW.place_id, ST_Centroid(NEW.geometry);
|
||||
USING NEW.place_id, NEW.centroid;
|
||||
END IF;
|
||||
|
||||
{% endif %} -- not disable_diff_updates
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
--
|
||||
-- This file is part of Nominatim. (https://nominatim.org)
|
||||
--
|
||||
-- Copyright (C) 2022 by the Nominatim developer community.
|
||||
-- Copyright (C) 2025 by the Nominatim developer community.
|
||||
-- For a full list of authors see the git log.
|
||||
|
||||
-- Assorted helper functions for the triggers.
|
||||
@@ -14,14 +14,14 @@ DECLARE
|
||||
geom_type TEXT;
|
||||
BEGIN
|
||||
geom_type := ST_GeometryType(place);
|
||||
IF geom_type = ' ST_Point' THEN
|
||||
IF geom_type = 'ST_Point' THEN
|
||||
RETURN place;
|
||||
END IF;
|
||||
IF geom_type = 'ST_LineString' THEN
|
||||
RETURN ST_LineInterpolatePoint(place, 0.5);
|
||||
RETURN ST_ReducePrecision(ST_LineInterpolatePoint(place, 0.5), 0.0000001);
|
||||
END IF;
|
||||
|
||||
RETURN ST_PointOnSurface(place);
|
||||
RETURN ST_ReducePrecision(ST_PointOnSurface(place), 0.0000001);
|
||||
END;
|
||||
$$
|
||||
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
Reference in New Issue
Block a user