From f127d4a18efa7c75203d9affff31285ae85c1339 Mon Sep 17 00:00:00 2001 From: Carla Iriberri Date: Thu, 18 Aug 2016 17:38:24 +0200 Subject: [PATCH] Update 0.3.1 version with voronoi fix --- release/crankshaft--0.3.0--0.3.1.sql | 19 +++++++++++++++---- release/crankshaft--0.3.1.sql | 19 +++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/release/crankshaft--0.3.0--0.3.1.sql b/release/crankshaft--0.3.0--0.3.1.sql index a4410de..79ac280 100644 --- a/release/crankshaft--0.3.0--0.3.1.sql +++ b/release/crankshaft--0.3.0--0.3.1.sql @@ -378,7 +378,7 @@ BEGIN convexhull_1 as ( SELECT ST_ConvexHull(ST_Collect(geomin)) as g, - buffer * |/ st_area(ST_ConvexHull(ST_Collect(geomin))) as r + buffer * |/ (st_area(ST_ConvexHull(ST_Collect(geomin)))/PI()) as r ), clipper as( SELECT @@ -498,15 +498,26 @@ BEGIN SELECT (st_dump(v.g)).geom as g FROM voro_cells v + ), + clipped_voro as( + SELECT + ST_intersection(c.g, v.g) as g + FROM + voro_set v, + clipper c + WHERE + ST_GeometryType(v.g) = 'ST_Polygon' ) SELECT st_collect( - ST_Transform(ST_intersection(c.g, v.g), 4326) + ST_Transform( + ST_ConvexHull(g), + 4326 + ) ) INTO geomout FROM - voro_set v, - clipper c; + clipped_voro; RETURN geomout; END; $$ language plpgsql IMMUTABLE; diff --git a/release/crankshaft--0.3.1.sql b/release/crankshaft--0.3.1.sql index a4410de..79ac280 100644 --- a/release/crankshaft--0.3.1.sql +++ b/release/crankshaft--0.3.1.sql @@ -378,7 +378,7 @@ BEGIN convexhull_1 as ( SELECT ST_ConvexHull(ST_Collect(geomin)) as g, - buffer * |/ st_area(ST_ConvexHull(ST_Collect(geomin))) as r + buffer * |/ (st_area(ST_ConvexHull(ST_Collect(geomin)))/PI()) as r ), clipper as( SELECT @@ -498,15 +498,26 @@ BEGIN SELECT (st_dump(v.g)).geom as g FROM voro_cells v + ), + clipped_voro as( + SELECT + ST_intersection(c.g, v.g) as g + FROM + voro_set v, + clipper c + WHERE + ST_GeometryType(v.g) = 'ST_Polygon' ) SELECT st_collect( - ST_Transform(ST_intersection(c.g, v.g), 4326) + ST_Transform( + ST_ConvexHull(g), + 4326 + ) ) INTO geomout FROM - voro_set v, - clipper c; + clipped_voro; RETURN geomout; END; $$ language plpgsql IMMUTABLE;