Housenumber and POI calc optimisation (#247)
Using NPoints(Centroid) = NPoints, thanks edpop
This commit is contained in:
parent
239f0c6643
commit
0a26d2be99
@ -4,7 +4,13 @@ DROP TRIGGER IF EXISTS trigger_refresh ON housenumber.updates;
|
|||||||
-- etldoc: osm_housenumber_point -> osm_housenumber_point
|
-- etldoc: osm_housenumber_point -> osm_housenumber_point
|
||||||
CREATE OR REPLACE FUNCTION convert_housenumber_point() RETURNS VOID AS $$
|
CREATE OR REPLACE FUNCTION convert_housenumber_point() RETURNS VOID AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
UPDATE osm_housenumber_point SET geometry=ST_PointOnSurface(geometry) WHERE ST_GeometryType(geometry) <> 'ST_Point';
|
UPDATE osm_housenumber_point
|
||||||
|
SET geometry =
|
||||||
|
CASE WHEN ST_NPoints(ST_ConvexHull(geometry))=ST_NPoints(geometry)
|
||||||
|
THEN ST_Centroid(geometry)
|
||||||
|
ELSE ST_PointOnSurface(geometry)
|
||||||
|
END
|
||||||
|
WHERE ST_GeometryType(geometry) <> 'ST_Point';
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,13 @@ DROP TRIGGER IF EXISTS trigger_refresh ON poi.updates;
|
|||||||
|
|
||||||
CREATE OR REPLACE FUNCTION convert_poi_point() RETURNS VOID AS $$
|
CREATE OR REPLACE FUNCTION convert_poi_point() RETURNS VOID AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
UPDATE osm_poi_polygon SET geometry=ST_PointOnSurface(geometry) WHERE ST_GeometryType(geometry) <> 'ST_Point';
|
UPDATE osm_poi_polygon
|
||||||
|
SET geometry =
|
||||||
|
CASE WHEN ST_NPoints(ST_ConvexHull(geometry))=ST_NPoints(geometry)
|
||||||
|
THEN ST_Centroid(geometry)
|
||||||
|
ELSE ST_PointOnSurface(geometry)
|
||||||
|
END
|
||||||
|
WHERE ST_GeometryType(geometry) <> 'ST_Point';
|
||||||
ANALYZE osm_poi_polygon;
|
ANALYZE osm_poi_polygon;
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user