Fix the tests for adjacent union function
This commit is contained in:
parent
69b6aa6aca
commit
9e2f2b7c2d
@ -1,5 +1,22 @@
|
|||||||
st_astext
|
\i test/fixtures/touching_polygons.sql
|
||||||
|
-- test table (polygons, some of which touch and some which dont)
|
||||||
|
CREATE TABLE touching_polygons(cartodb_id integer, the_geom geometry);
|
||||||
|
INSERT INTO touching_polygons VALUES
|
||||||
|
(1, ST_GeomFromText('POLYGON ((0 0, 1 0,1 1, 0 1, 0 0 ))')),
|
||||||
|
(2, ST_GeomFromText('POLYGON ((1 0, 2 0, 2 1, 1 1, 1 0))')),
|
||||||
|
(1, ST_GeomFromText('POLYGON ((0 1, 1 1,1 2, 0 2, 0 1 ))')),
|
||||||
|
(4, ST_GeomFromText('POLYGON ((3 0, 4 0, 4 1, 3 1, 3 0))')),
|
||||||
|
(5, ST_GeomFromText('POLYGON ((3 1, 4 1, 4 2, 3 2, 3 1))'));
|
||||||
|
WITH joined_polygons AS (
|
||||||
|
SELECT cdb_crankshaft.cdb_union_adjacent(the_geom) the_geom FROM touching_polygons
|
||||||
|
),
|
||||||
|
unnested_polygons as (
|
||||||
|
select unnest(joined_polygons.the_geom) the_geom from joined_polygons
|
||||||
|
)
|
||||||
|
select ST_ASTEXT(unnested_polygons.the_geom) from unnested_polygons;
|
||||||
|
st_astext
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
POLYGON((1 0,0 0,0 1,0 2,1 2,1 1,2 1,2 0,1 0))
|
POLYGON((1 0,0 0,0 1,0 2,1 2,1 1,2 1,2 0,1 0))
|
||||||
POLYGON((4 1,4 0,3 0,3 1,3 2,4 2,4 1))
|
POLYGON((4 1,4 0,3 0,3 1,3 2,4 2,4 1))
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
\i test/fixtures/touching_polygons.sql
|
\i test/fixtures/touching_polygons.sql
|
||||||
|
|
||||||
WITH joined_polygons AS (
|
WITH joined_polygons AS (
|
||||||
SELECT cdb_union_adjacent(the_geom) the_geom FROM touching_polygons
|
SELECT cdb_crankshaft.cdb_union_adjacent(the_geom) the_geom FROM touching_polygons
|
||||||
),
|
),
|
||||||
unnested_polygons as (
|
unnested_polygons as (
|
||||||
select unnest(joined_polygons.the_geom) the_geom from joined_polygons
|
select unnest(joined_polygons.the_geom) the_geom from joined_polygons
|
||||||
|
Loading…
Reference in New Issue
Block a user