Update 0.3.1 version with voronoi fix

This commit is contained in:
Carla Iriberri 2016-08-18 17:38:24 +02:00
parent 9016e5f35e
commit f127d4a18e
2 changed files with 30 additions and 8 deletions

View File

@ -378,7 +378,7 @@ BEGIN
convexhull_1 as ( convexhull_1 as (
SELECT SELECT
ST_ConvexHull(ST_Collect(geomin)) as g, 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( clipper as(
SELECT SELECT
@ -498,15 +498,26 @@ BEGIN
SELECT SELECT
(st_dump(v.g)).geom as g (st_dump(v.g)).geom as g
FROM voro_cells v 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 SELECT
st_collect( st_collect(
ST_Transform(ST_intersection(c.g, v.g), 4326) ST_Transform(
ST_ConvexHull(g),
4326
)
) )
INTO geomout INTO geomout
FROM FROM
voro_set v, clipped_voro;
clipper c;
RETURN geomout; RETURN geomout;
END; END;
$$ language plpgsql IMMUTABLE; $$ language plpgsql IMMUTABLE;

View File

@ -378,7 +378,7 @@ BEGIN
convexhull_1 as ( convexhull_1 as (
SELECT SELECT
ST_ConvexHull(ST_Collect(geomin)) as g, 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( clipper as(
SELECT SELECT
@ -498,15 +498,26 @@ BEGIN
SELECT SELECT
(st_dump(v.g)).geom as g (st_dump(v.g)).geom as g
FROM voro_cells v 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 SELECT
st_collect( st_collect(
ST_Transform(ST_intersection(c.g, v.g), 4326) ST_Transform(
ST_ConvexHull(g),
4326
)
) )
INTO geomout INTO geomout
FROM FROM
voro_set v, clipped_voro;
clipper c;
RETURN geomout; RETURN geomout;
END; END;
$$ language plpgsql IMMUTABLE; $$ language plpgsql IMMUTABLE;