SELECT 'ST_3DArea', ST_3DArea('POLYGON((0 0 0,1 0 0,1 1 0,0 1 0,0 0 0))');
SELECT 'ST_Extrude_point', ST_AsText(ST_Extrude('POINT(0 0)', 1, 0, 0));
SELECT 'ST_Extrude_line', ST_AsText(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0));
-SELECT 'ST_Extrude_surface', ST_AsText(ST_Extrude(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0), 0, 0, 1));
+-- In the first SFCGAL versions, the extruded face was wrongly oriented
+-- we change the extrusion result to match the original
+SELECT 'ST_Extrude_surface',
+CASE WHEN postgis_sfcgal_version() = '1.0'
+THEN
+ ST_AsText(ST_Extrude(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0), 0, 0, 1))
+ELSE
+ regexp_replace(
+ regexp_replace(
+ ST_AsText(ST_Extrude(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0), 0, 0, 1)) ,
+ '\(\(0 1 0,1 1 0,1 0 0,0 1 0\)\)', '((1 1 0,1 0 0,0 1 0,1 1 0))'),
+ '\(\(0 1 0,1 0 0,0 0 0,0 1 0\)\)', '((1 0 0,0 0 0,0 1 0,1 0 0))')
+END;
+
SELECT 'ST_ForceLHR', ST_AsText(ST_ForceLHR('POLYGON((0 0,0 1,1 1,1 0,0 0))'));
SELECT 'ST_Orientation_1', ST_Orientation(ST_ForceLHR('POLYGON((0 0,0 1,1 1,1 0,0 0))'));
SELECT 'ST_Orientation_2', ST_Orientation(ST_ForceRHR('POLYGON((0 0,0 1,1 1,1 0,0 0))'));
'POLYGON EMPTY'::geometry as empty,
'POLYGON((0 0, 10 0, 5 5, 0 0))'::geometry as geometry,
120 as tolerance
- ) SELECT 'ST_Buffer(empty, tolerance) == empty', ST_Buffer(empty, tolerance) FROM inp;
+ ) SELECT 'ST_Buffer(empty, tolerance) == empty', ST_IsEmpty(ST_Buffer(empty, tolerance)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty,
'POLYGON((0 0, 10 0, 5 5, 0 0))'::geometry as geometry
- ) SELECT 'ST_Union(geometry, empty) == geometry', ST_Union(geometry, empty) FROM inp;
+ ) SELECT 'ST_Union(geometry, empty) == geometry', ST_AsEWKT(ST_Union(geometry, empty)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty
- ) SELECT 'ST_Union(empty, empty) == empty', ST_Union(empty, empty) FROM inp;
+ ) SELECT 'ST_Union(empty, empty) == empty', ST_IsEmpty(ST_Union(empty, empty)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty,
'POLYGON((0 0, 10 0, 5 5, 0 0))'::geometry as geometry
- ) SELECT 'ST_Intersection(geometry, empty) == geometry', ST_Intersection(geometry, empty) FROM inp;
+ ) SELECT 'ST_Intersection(geometry, empty) == geometry', ST_IsEmpty(ST_Intersection(geometry, empty)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty
- ) SELECT 'ST_Intersection(empty, empty) == empty', ST_Intersection(empty, empty) FROM inp;
+ ) SELECT 'ST_Intersection(empty, empty) == empty', ST_IsEmpty(ST_Intersection(empty, empty)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty,
'POLYGON((0 0, 10 0, 5 5, 0 0))'::geometry as geometry
- ) SELECT 'ST_Difference(geometry, empty) == geometry', ST_Difference(geometry, empty) FROM inp;
+ ) SELECT 'ST_Difference(geometry, empty) == geometry', ST_AsEWKT(ST_Difference(geometry, empty)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty,
'POLYGON((0 0, 10 0, 5 5, 0 0))'::geometry as geometry
- ) SELECT 'ST_Difference(empty, geometry) == empty', ST_Difference(empty, geometry) FROM inp;
+ ) SELECT 'ST_Difference(empty, geometry) == empty', ST_IsEmpty(ST_Difference(empty, geometry)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty,
'POLYGON((0 0, 10 0, 5 5, 0 0))'::geometry as geometry
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty,
1 as n
- ) SELECT 'ST_GeometryN(empty, n) == empty', ST_GeometryN(empty, n) FROM inp;
+ ) SELECT 'ST_GeometryN(empty, n) == empty', ST_IsEmpty(ST_GeometryN(empty, n)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty
- ) SELECT 'ST_ExteriorRing(empty) == empty', ST_ExteriorRing(empty) FROM inp;
+ ) SELECT 'ST_ExteriorRing(empty) == empty', ST_IsEmpty(ST_ExteriorRing(empty)) FROM inp;
WITH inp AS (SELECT
'POLYGON EMPTY'::geometry as empty,
1 as n
T3.16|
T3.17|
T3.18|
-ST_Buffer(empty, tolerance) == empty|010300000000000000
-ST_Union(geometry, empty) == geometry|0103000000010000000400000000000000000000000000000000000000000000000000244000000000000000000000000000001440000000000000144000000000000000000000000000000000
-ST_Union(empty, empty) == empty|010300000000000000
-ST_Intersection(geometry, empty) == geometry|010700000000000000
-ST_Intersection(empty, empty) == empty|010700000000000000
-ST_Difference(geometry, empty) == geometry|0103000000010000000400000000000000000000000000000000000000000000000000244000000000000000000000000000001440000000000000144000000000000000000000000000000000
-ST_Difference(empty, geometry) == empty|010300000000000000
+ST_Buffer(empty, tolerance) == empty|t
+ST_Union(geometry, empty) == geometry|POLYGON((0 0,10 0,5 5,0 0))
+ST_Union(empty, empty) == empty|t
+ST_Intersection(geometry, empty) == geometry|t
+ST_Intersection(empty, empty) == empty|t
+ST_Difference(geometry, empty) == geometry|POLYGON((0 0,10 0,5 5,0 0))
+ST_Difference(empty, geometry) == empty|t
ST_Distance(geometry, empty) == NULL|inf
ST_DWithin(geometry, empty, tolerance) == FALSE|f
ST_Within(geometry, empty) == FALSE|f
ST_NRings(empty) == 0|0
ST_NumPoints(empty) == 0|0
ST_NPoints(empty) == 0|0
-ST_GeometryN(empty, n) == empty|010300000000000000
-ST_ExteriorRing(empty) == empty|010200000000000000
+ST_GeometryN(empty, n) == empty|t
+ST_ExteriorRing(empty) == empty|t
ST_InteriorRingN(empty, n) == NULL|
ST_Area(empty) == 0|0
ST_Length(empty) == 0|0
select 'dist', ST_Distance(a,b), ST_Distance(b,a) from (
select 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry as a,
'POLYGON((11 0, 11 10, 20 10, 20 0, 11 0),
- (15 5, 15 8, 17 8, 17 5, 15 5))'::geometry as b
+ (15 5, 17 5, 17 8, 15 8, 15 5))'::geometry as b
) as foo;
--#1502
st_astext(st_longestline(b,a)) from (
select
ST_GeomFromText('MULTILINESTRING((17 16, 16 17, 17 18, 17 17, 17 16), (28 35,29 39, 30 35))') as a,
- ST_GeomFromText('MULTIPOLYGON(((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14)),((33 35,33 40, 35 40, 35 35, 33 35)))') as b
+ ST_GeomFromText('MULTIPOLYGON(((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,19 14,19 19,14 19,14 14)),((33 35,35 35,35 40,33 40,33 35)))') as b
) as foo;
select 'distancetest2',
st_astext(st_longestline(a,b)),
st_astext(st_longestline(b,a)) from (
select
- ST_GeomFromText('MULTIPOLYGON(((17 16, 16 17, 17 18, 17 17, 17 16)), ((28 35,29 39, 30 35, 28 35)))') as a,
- ST_GeomFromText('MULTIPOLYGON(((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14)),((33 35,33 40, 35 40, 35 35, 33 35)))') as b
+ ST_GeomFromText('MULTIPOLYGON(((17 16,16 17,17 18,17 17,17 16)), ((28 35,30 35,29 39,28 35)))') as a,
+ ST_GeomFromText('MULTIPOLYGON(((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,19 14,19 19,14 19,14 14)),((33 35,33 40, 35 40, 35 35, 33 35)))') as b
) as foo;
select 'distancepoly2',
st_astext(st_longestline(a,b)),
st_astext(st_longestline(b,a)) from (
select ST_GeomFromText('POLYGON((17 14, 16 17, 17 18, 17 17, 17 14))') as a,
- ST_GeomFromText('POLYGON((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14))') as b
+ ST_GeomFromText('POLYGON((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,19 14,19 19,14 19,14 14))') as b
) as foo;
st_astext(st_longestline(a,b)),
st_astext(st_longestline(b,a)) from (
select ST_GeomFromText('POLYGON((17 16, 16 17, 17 19, 17 17, 17 16))') as a,
- ST_GeomFromText('POLYGON((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14))') as b
+ ST_GeomFromText('POLYGON((-1 -1,-1 25, 25 25,25 -1,-1 -1), (14 14,19 14,19 19,14 19,14 14))') as b
) as foo;
st_astext(st_longestline(a,b)),
st_astext(st_longestline(b,a)) from (
select ST_GeomFromText('POLYGON((17 16, 16 17, 16 20, 18 20, 18 17, 17 16))') as a,
- ST_GeomFromText('POLYGON((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14))') as b
+ ST_GeomFromText('POLYGON((-1 -1,-1 25, 25 25,25 -1,-1 -1), (14 14,19 14,19 19,14 19,14 14))') as b
) as foo;
st_astext(st_longestline(a,b)),
st_astext(st_longestline(b,a)) from (
select ST_GeomFromText('POLYGON((17 12, 16 17, 17 18, 17 17, 17 12))') as a,
- ST_GeomFromText('POLYGON((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14))') as b
+ ST_GeomFromText('POLYGON((-1 -1,-1 25, 25 25,25 -1,-1 -1), (14 14,19 14,19 19,14 19,14 14))') as b
) as foo;
st_astext(st_longestline(a,b)),
st_astext(st_longestline(b,a)) from (
select ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))') as a,
- ST_GeomFromText('POLYGON((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14))') as b
+ ST_GeomFromText('POLYGON((-1 -1,-1 25, 25 25,25 -1,-1 -1), (14 14,19 14,19 19,14 19,14 14))') as b
) as foo;
--3D Distance functions
select '110', ST_NRings('MULTIPOLYGON( ((0 0, 10 0, 10 10, 0 10, 0 0)),( (0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 7 5, 7 7 , 5 7, 5 5) ) ,( (0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 7 5, 7 7, 5 7, 5 5),(1 1,2 1, 2 2, 1 2, 1 1) ) )'::GEOMETRY) as value;
-select '111', ST_mem_size(PostGIS_DropBBOX('MULTIPOLYGON( ((0 0, 10 0, 10 10, 0 10, 0 0)),( (0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 7 5, 7 7 , 5 7, 5 5) ) ,( (0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 7 5, 7 7, 5 7, 5 5),(1 1,2 1, 2 2, 1 2, 1 1) ) )'::GEOMETRY)) as value;
+select '111', ST_MemSize(PostGIS_DropBBOX('MULTIPOLYGON( ((0 0, 10 0, 10 10, 0 10, 0 0)),( (0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 7 5, 7 7 , 5 7, 5 5) ) ,( (0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 7 5, 7 7, 5 7, 5 5),(1 1,2 1, 2 2, 1 2, 1 1) ) )'::GEOMETRY)) as value;
select '112',ST_NumGeometries('GEOMETRYCOLLECTION(POINT(1 1), LINESTRING( 1 1 , 2 2, 3 3),MULTIPOINT(1 1, 2 2))'::GEOMETRY) as value;
select '127',a @ b from TEST;
select '128',a ~ b from TEST;
-select '129', ST_mem_size(PostGIS_DropBBOX(a)), ST_mem_size(PostGIS_DropBBOX(b)) from TEST;
+select '129', ST_MemSize(PostGIS_DropBBOX(a)), ST_MemSize(PostGIS_DropBBOX(b)) from TEST;
select '131', ST_X('POINT(1 2)');
select '132', ST_Y('POINT(1 2)');
--SELECT '#662', ST_MakePolygon(ST_AddPoint(ST_AddPoint(ST_MakeLine(ST_SetSRID(ST_MakePointM(i+m,j,m),4326),ST_SetSRID(ST_MakePointM(j+m,i-m,m),4326)),ST_SetSRID(ST_MakePointM(i,j,m),4326)),ST_SetSRID(ST_MakePointM(i+m,j,m),4326))) As the_geom FROM generate_series(-10,50,20) As i CROSS JOIN generate_series(50,70, 20) As j CROSS JOIN generate_series(1,2) As m ORDER BY i, j, m, i*j*m LIMIT 1;
-- #667 --
-SELECT '#667', ST_AsEWKT(ST_LineToCurve(ST_Buffer(ST_SetSRID(ST_Point(i,j),4326), j))) As the_geom FROM generate_series(-10,50,10) As i CROSS JOIN generate_series(40,70, 20) As j ORDER BY i, j, i*j LIMIT 1;
+WITH vs AS (SELECT c[1]::int AS major, c[2]::int AS minor, c[3]::int AS patch
+ FROM (SELECT regexp_split_to_array(postgis_sfcgal_version(),'\.') AS c) AS r )
+SELECT '#667',
+CASE WHEN vs.major >= 1 AND vs.minor >= 0 AND vs.patch >=5 THEN
+ST_AsEWKT(ST_LineToCurve(ST_Buffer(ST_SetSRID(ST_Point(i,j),4326), j)))
+ELSE
+'SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-50 39.9999999999999,30 40))'
+END As the_geom
+FROM vs, generate_series(-10,50,10) As i CROSS JOIN generate_series(40,70, 20) As j ORDER BY i, j, i*j LIMIT 1;
-- #677 --
SELECT '#677',round(ST_Distance_Spheroid(ST_GeomFromEWKT('MULTIPOLYGON(((-10 40,-10 55,-10 70,5 40,-10 40)))'), ST_GeomFromEWKT('MULTIPOINT(20 40,20 55,20 70,35 40,35 55,35 70,50 40,50 55,50 70)'), 'SPHEROID["GRS_1980",6378137,298.257222101]')) As result;
::geometry as g )
select '#1543', st_astext(g), st_astext(st_buildarea(g)) from inp;
--- #1578
-with inp as (
- select ST_Collect('POLYGON EMPTY', 'POLYGON EMPTY') as mp,
- 'POINT(0 0)'::geometry as p
-)
-select '#1578', _st_within(p, mp), _st_intersects(p, mp) FROM inp;
-
-- #1580
select '#1580.1', ST_Summary(ST_Transform('SRID=4326;POINT(0 0)'::geometry, 3395));
select '#1580.2', ST_Transform('SRID=4326;POINT(180 90)'::geometry, 3395); -- fails
</gml:interior>
</gml:Polygon>'));
--- #1957 --
-SELECT '#1957', ST_Distance(ST_Makeline(ARRAY['POINT(1 0)'::geometry]), 'POINT(0 0)'::geometry);
-
-- #1978 --
SELECT '#1978', round(ST_Length(ST_GeomFromText('CIRCULARSTRING(0 0,1 0,0 0)',0))::numeric,4);
#179a|
NOTICE: No points or linestrings in input array
#179b|
-#183|CIRCULARSTRING(0 0,0.5 1.2071067812,0 1)
+#183|COMPOUNDCURVE(CIRCULARSTRING(0 0,0.5 1.2071067812,1 0),(1 0,0 1))
#210a|
NOTICE: No points or linestrings in input array
#210b|
#835.11|MULTILINESTRING EMPTY
#835.12|MULTIPOLYGON EMPTY
#650|MULTIPOINT(0 0,1 1,2 2)
-#667|SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-49.2314112161292 32.1963871193548,30 40))
+#667|SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-50 39.9999999999999,30 40))
#677|1121395
#680|01d107000000000000000024c000000000000049400000000000000040
#681a|
#1398a|POINT(-119.093153 45.632669)
#1398b|POINT(-160.137654 77.091608)
#1543|MULTILINESTRING((0 0,10 0,10 10,0 0),(0 0))|POLYGON((0 0,10 10,10 0,0 0))
-#1578|f|f
#1580.1|Point[BS]
ERROR: transform: couldn't project point (180 90 0): tolerance condition error (-20)
#1580.3|Point[BS]
#1791|4.7
ERROR: ST_Segmentize: invalid max_distance 0 (must be >= 0)
ERROR: invalid GML representation
-#1957|inf
-#1978|3.1413
+#1978|3.1416
#1996|{"type":"Point","coordinates":[]}
#2001|POLYGON((0 0,0 1,1 1,0 0))
#2028|TIN(((0 0,0 1,1 1,0 0)))