Merge pull request #112 from CartoDB/add-voronoi

[Hot Fix] Voronoi projection issue [09]
This commit is contained in:
Carla
2016-08-18 10:13:53 +02:00
committed by GitHub
3 changed files with 14 additions and 4 deletions

View File

@@ -12,6 +12,15 @@ RETURNS geometry AS $$
DECLARE
geomout geometry;
BEGIN
-- we need to make the geometry calculations in (pseudo)meters!!!
with a as (
SELECT unnest(geomin) as g1
),
b as(
SELECT st_transform(g1, 3857) g2 from a
)
SELECT array_agg(g2) INTO geomin from b;
WITH
convexhull_1 as (
SELECT
@@ -138,8 +147,9 @@ BEGIN
FROM voro_cells v
)
SELECT
st_collect(ST_intersection(c.g, v.g))
-- ST_intersection(c.g, v.g)
st_collect(
ST_Transform(ST_intersection(c.g, v.g), 4326)
)
INTO geomout
FROM
voro_set v,

View File

@@ -2,6 +2,6 @@ SET client_min_messages TO WARNING;
\set ECHO none
avg_area
----------------------
0.000139602712846995
0.000200480682454162
(1 row)

View File

@@ -3,7 +3,7 @@ SET client_min_messages TO WARNING;
WITH a AS (
SELECT
ARRAY[ST_GeomFromText('POINT(2.1744 41.403)'),ST_GeomFromText('POINT(2.1228 41.380)'),ST_GeomFromText('POINT(2.1511 41.374)'),ST_GeomFromText('POINT(2.1528 41.413)'),ST_GeomFromText('POINT(2.165 41.391)'),ST_GeomFromText('POINT(2.1498 41.371)'),ST_GeomFromText('POINT(2.1533 41.368)'),ST_GeomFromText('POINT(2.131386 41.41399)')] AS geomin
ARRAY[ST_GeomFromText('POINT(2.1744 41.403)', 4326),ST_GeomFromText('POINT(2.1228 41.380)', 4326),ST_GeomFromText('POINT(2.1511 41.374)', 4326),ST_GeomFromText('POINT(2.1528 41.413)', 4326),ST_GeomFromText('POINT(2.165 41.391)', 4326),ST_GeomFromText('POINT(2.1498 41.371)', 4326),ST_GeomFromText('POINT(2.1533 41.368)', 4326),ST_GeomFromText('POINT(2.131386 41.41399)', 4326)] AS geomin
),
b as(
SELECT