Commit 5313b69c authored by Mark Leslie's avatar Mark Leslie

Added versions of functions with standard ST (Spatial Type) prefixes to any...

Added versions of functions with standard ST (Spatial Type) prefixes to any functions that were lacking them.  Updated the regression tests to include the new functions.

git-svn-id: http://svn.osgeo.org/postgis/trunk@2616 b70326c6-7e19-0410-871a-916f4a2858ee
parent aad405de
2007-06-04 Mark Leslie <mleslie@refractions.net>
* lwgeom/lwpostgis.sql.in, lwgeom/sqlmm.sql.in:
Added ST_ prefixed function versions where they were lacking.
* regress:
Added tests for the new function names.
2007-05-25 Mark Leslie <mleslie@refractions.net>
* lwgeom/lwgeom_ogc.c:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -378,7 +378,7 @@ CREATEFUNCTION ST_OrderingEquals(geometry, geometry)
CREATEFUNCTION SE_Is3D(geometry)
RETURNS boolean
AS '
SELECT CASE zmflag($1)
SELECT CASE ST_zmflag($1)
WHEN 0 THEN false
WHEN 1 THEN false
WHEN 2 THEN true
......@@ -392,7 +392,7 @@ CREATEFUNCTION SE_Is3D(geometry)
CREATEFUNCTION SE_IsMeasured(geometry)
RETURNS boolean
AS '
SELECT CASE zmflag($1)
SELECT CASE ST_zmflag($1)
WHEN 0 THEN false
WHEN 1 THEN true
WHEN 2 THEN false
......
......@@ -49,3 +49,54 @@ select 'tscale_bbox', box2d(transscale('LINESTRING(1 0, 2 1)'::geometry, 2, 1, 1
select 'rotZ_bbox', box2d(SnapToGrid(rotateZ('LINESTRING(0 0, 1 0)'::geometry, pi()), 0.1));
select 'rotY_bbox', box2d(SnapToGrid(rotateY('LINESTRING(0 0, 1 0)'::geometry, pi()), 0.1));
-- Repeat all tests with the new function names.
-- translate
select 'translate', ST_asewkt(ST_translate('POINT(0 0)'::geometry, 5, 12));
select 'translate', ST_asewkt(ST_translate('POINT(0 0 0)'::geometry, -3, -7, 3));
-- scale
select 'scale', ST_asewkt(ST_scale('POINT(1 1)'::geometry, 5, 5));
select 'scale', ST_asewkt(ST_scale('POINT(1 1)'::geometry, 3, 2));
select 'scale', ST_asewkt(ST_scale('POINT(10 20 -5)'::geometry, 4, 2, -8));
-- rotateZ
select 'rotateZ', ST_asewkt(ST_SnapToGrid(rotateZ('POINT(1 1)'::geometry, pi()), 0.1));
select 'rotateZ', ST_asewkt(ST_SnapToGrid(rotateZ('POINT(1 1)'::geometry, pi()/2), 0.1));
select 'rotateZ', ST_asewkt(ST_SnapToGrid(rotateZ('POINT(1 1)'::geometry, pi()+pi()/2), 0.1));
select 'rotateZ', ST_asewkt(ST_SnapToGrid(rotateZ('POINT(1 1)'::geometry, 2*pi()), 0.1));
-- rotateY
select 'rotateY', ST_asewkt(ST_SnapToGrid(rotateY('POINT(1 1 1)'::geometry, pi()), 0.1));
select 'rotateY', ST_asewkt(ST_SnapToGrid(rotateY('POINT(1 1 1)'::geometry, pi()/2), 0.1));
select 'rotateY', ST_asewkt(ST_SnapToGrid(rotateY('POINT(1 1 1)'::geometry, pi()+pi()/2), 0.1));
select 'rotateY', ST_asewkt(ST_SnapToGrid(rotateY('POINT(1 1 1)'::geometry, 2*pi()), 0.1));
-- rotateX
select 'rotateX', ST_asewkt(ST_SnapToGrid(rotateX('POINT(1 1 1)'::geometry, pi()), 0.1));
select 'rotateX', ST_asewkt(ST_SnapToGrid(rotateX('POINT(1 1 1)'::geometry, pi()/2), 0.1));
select 'rotateX', ST_asewkt(ST_SnapToGrid(rotateX('POINT(1 1 1)'::geometry, pi()+pi()/2), 0.1));
select 'rotateX', ST_asewkt(ST_SnapToGrid(rotateX('POINT(1 1 1)'::geometry, 2*pi()), 0.1));
-- transscale
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,1, 1, 1, 1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(2 2)'::geometry,1, 1, 1, 1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,-1, -1, -1, -1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,0, 1, 1, 1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,1, 0, 1, 1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,1, 1, 0, 1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,1, 1, 1, 0), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,2, 1, 1, 1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,1, 2, 1, 1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,1, 1, 2, 1), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,1, 1, 1, 2), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1)'::geometry,2, 3, 5, 7), 0.1));
select 'transscale', ST_asewkt(ST_snapToGrid(transscale('POINT(1 1 1)'::geometry,2, 3, 5, 7), 0.1));
-- postgis-users/2006-May/012119.html
select 'transl_bbox', ST_box2d(ST_translate('LINESTRING(0 0, 1 1)'::geometry, 1, 0, 0));
select 'scale_bbox', ST_box2d(ST_scale('LINESTRING(1 0, 2 1)'::geometry, 2, 0));
select 'tscale_bbox', ST_box2d(ST_transscale('LINESTRING(1 0, 2 1)'::geometry, 2, 1, 1, 1));
select 'rotZ_bbox', ST_box2d(ST_SnapToGrid(rotateZ('LINESTRING(0 0, 1 0)'::geometry, pi()), 0.1));
select 'rotY_bbox', ST_box2d(ST_SnapToGrid(rotateY('LINESTRING(0 0, 1 0)'::geometry, pi()), 0.1));
......@@ -33,3 +33,38 @@ scale_bbox|BOX(2 0,4 0)
tscale_bbox|BOX(3 1,4 2)
rotZ_bbox|BOX(-1 0,0 0)
rotY_bbox|BOX(-1 0,0 0)
translate|POINT(5 12)
translate|POINT(-3 -7 3)
scale|POINT(5 5)
scale|POINT(3 2)
scale|POINT(40 40 40)
rotateZ|POINT(-1 -1)
rotateZ|POINT(-1 1)
rotateZ|POINT(1 -1)
rotateZ|POINT(1 1)
rotateY|POINT(-1 1 -1)
rotateY|POINT(1 1 -1)
rotateY|POINT(-1 1 1)
rotateY|POINT(1 1 1)
rotateX|POINT(1 -1 -1)
rotateX|POINT(1 -1 1)
rotateX|POINT(1 1 -1)
rotateX|POINT(1 1 1)
transscale|POINT(2 2)
transscale|POINT(3 3)
transscale|POINT(0 0)
transscale|POINT(1 2)
transscale|POINT(2 1)
transscale|POINT(0 2)
transscale|POINT(2 0)
transscale|POINT(3 2)
transscale|POINT(2 3)
transscale|POINT(4 2)
transscale|POINT(2 4)
transscale|POINT(15 28)
transscale|POINT(15 28 1)
transl_bbox|BOX(1 0,2 1)
scale_bbox|BOX(2 0,4 0)
tscale_bbox|BOX(3 1,4 2)
rotZ_bbox|BOX(-1 0,0 0)
rotY_bbox|BOX(-1 0,0 0)
......@@ -12,3 +12,19 @@ select makebox2d('POINT(0 0)', 'SRID=3;POINT(1 1)');
select makebox3d('SRID=3;POINT(0 0)', 'SRID=3;POINT(1 1)');
select makebox3d('POINT(0 0)', 'SRID=3;POINT(1 1)');
-- Repeat all tests with the new function names.
-- postgis-users/2006-July/012764.html
SELECT ST_SRID(collect('SRID=32749;POINT(0 0)', 'SRID=32749;POINT(1 1)'));
SELECT ST_collect('SRID=32749;POINT(0 0)', 'SRID=32740;POINT(1 1)');
select ST_asewkt(makeline('SRID=3;POINT(0 0)', 'SRID=3;POINT(1 1)'));
select ST_makeline('POINT(0 0)', 'SRID=3;POINT(1 1)');
-- postgis-users/2006-July/012788.html
select ST_makebox2d('SRID=3;POINT(0 0)', 'SRID=3;POINT(1 1)');
select ST_makebox2d('POINT(0 0)', 'SRID=3;POINT(1 1)');
select ST_makebox3d('SRID=3;POINT(0 0)', 'SRID=3;POINT(1 1)');
select ST_makebox3d('POINT(0 0)', 'SRID=3;POINT(1 1)');
......@@ -6,3 +6,11 @@ BOX(0 0,1 1)
ERROR: Operation on mixed SRID geometries
BOX3D(0 0 0,1 1 0)
ERROR: Operation on mixed SRID geometries
32749
ERROR: Operation on mixed SRID geometries
SRID=3;LINESTRING(0 0,1 1)
ERROR: Operation on mixed SRID geometries
BOX(0 0,1 1)
ERROR: Operation on mixed SRID geometries
BOX3D(0 0 0,1 1 0)
ERROR: Operation on mixed SRID geometries
......@@ -51,5 +51,45 @@ SELECT AsKML(GeomFromEWKT('SRID=1021892;POINT(1097247.52170185 1240255.74263751)
-- National Astronomical Observatory of Colombia - Bogota, Colombia (Placemark)
SELECT AsKML(GeomFromEWKT('SRID=1021892;POINT(1000000 1000000)'));
-- Repeat all tests with the new function names.
-- NO SRID PROVIDED
SELECT ST_AsKML(ST_GeomFromEWKT('POINT(1 1)'));
-- UNSUPPORTED GEOMETRY TYPES
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)'));
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))'));
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0))'));
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))'));
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)),((7 8,10 10,6 14,4 11,7 8)))'));
-- PARAMETERS
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;POINT(1 1)'), 0);
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;POINT(1 1)'), 16);
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;POINT(1 1)'), 15, 3);
-- SIMPLE FEATURES
-- San Felipe de Barajas Fortresses - Cartagena, Colombia (Placemark) http://en.wikipedia.org/wiki/Cartagena%2C_Bol%C3%ADvar
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;POINT(-75.55217297757488 10.42033663453054)'));
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;POINT(-75.55217297757488 10.42033663453054)'), 10);
-- Olaya Herrera Airport - Medellin, Colombia (Path) http://en.wikipedia.org/wiki/Olaya_Herrera_Airport
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;LINESTRING(-75.58845168747847 6.230811711917435, -75.59257646818483 6.209034252575331)'));
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;LINESTRING(-75.58845168747847 6.230811711917435, -75.59257646818483 6.209034252575331)'), 10);
-- Unicentro Shopping Centre - Bogota, Colombia (Polygon) http://www.unicentrobogota.com/
SELECT ST_AsKML(ST_SnapToGrid(GeomFromEWKT('SRID=4326;POLYGON((-74.0423991077642 4.70128819450968, -74.04209925973704 4.700950993650923, -74.0420182951016 4.701011516462908, -74.04183483125468 4.700831448835688, -74.0414862905795 4.70114015046422, -74.04132847200927 4.70097698051241, -74.04101990886149 4.701244756502166, -74.0411777421693 4.701425554204853, -74.04087244656924 4.701697127180076, -74.040940643764 4.701773680406961, -74.04089952744008 4.702605660205299, -74.04082413388542 4.702677666010084, -74.04106565350325 4.702949831221687, -74.04087265096442 4.703121094787139, -74.04118884713594 4.7034683330851, -74.04138264686453 4.703308983914091, -74.04173931195382 4.703688847671272, -74.04192370456995 4.703528238994438, -74.0419535628069 4.70355486096117, -74.04230657961881 4.703239478084376, -74.04207492135191 4.702978242710751, -74.0421546959669 4.702907817351857, -74.04195032608129 4.70267512672329, -74.04209558069562 4.702533577124568, -74.04203505048247 4.702466795922, -74.04205318281811 4.702038077671765, -74.04212335562635 4.701974337580458, -74.04198589330784 4.701816901909086, -74.04222167646385 4.70160442413543, -74.04214901975594 4.701519995786457, -74.0423991077642 4.70128819450968))'), 0.000001));
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;POLYGON((-74.0423991077642 4.70128819450968, -74.04209925973704 4.700950993650923, -74.0420182951016 4.701011516462908, -74.04183483125468 4.700831448835688, -74.0414862905795 4.70114015046422, -74.04132847200927 4.70097698051241, -74.04101990886149 4.701244756502166, -74.0411777421693 4.701425554204853, -74.04087244656924 4.701697127180076, -74.040940643764 4.701773680406961, -74.04089952744008 4.702605660205299, -74.04082413388542 4.702677666010084, -74.04106565350325 4.702949831221687, -74.04087265096442 4.703121094787139, -74.04118884713594 4.7034683330851, -74.04138264686453 4.703308983914091, -74.04173931195382 4.703688847671272, -74.04192370456995 4.703528238994438, -74.0419535628069 4.70355486096117, -74.04230657961881 4.703239478084376, -74.04207492135191 4.702978242710751, -74.0421546959669 4.702907817351857, -74.04195032608129 4.70267512672329, -74.04209558069562 4.702533577124568, -74.04203505048247 4.702466795922, -74.04205318281811 4.702038077671765, -74.04212335562635 4.701974337580458, -74.04198589330784 4.701816901909086, -74.04222167646385 4.70160442413543, -74.04214901975594 4.701519995786457, -74.0423991077642 4.70128819450968))'), 10);
-- MULTI FEATURES
-- Transmilenio mass-transit system Portal Stations - Bogota, Colombia (Placemarks) http://en.wikipedia.org/wiki/List_of_TransMilenio_Stations
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;MULTIPOINT((-74.04603457594773 4.754687006656519),(-74.095833 4.746435),(-74.11037547492613 4.7098754227297),(-74.120148 4.533696))'));
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=4326;MULTIPOINT((-74.04603457594773 4.754687006656519),(-74.095833 4.746435),(-74.11037547492613 4.7098754227297),(-74.120148 4.533696))'), 10);
-- REPROJECTED DATA
-- Sun Door Interchange - Bucaramanga, Colombia (Placemark)
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=1021892;POINT(1106465.31495947 1277689.13470039)'));
-- Chicamocha, Suarez and Fonce rivers confluence - Santander, Colombia (Placemark)
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=1021892;POINT(1097247.52170185 1240255.74263751)'));
-- National Astronomical Observatory of Colombia - Bogota, Colombia (Placemark)
SELECT ST_AsKML(ST_GeomFromEWKT('SRID=1021892;POINT(1000000 1000000)'));
DELETE FROM spatial_ref_sys WHERE srid = 4326;
DELETE FROM spatial_ref_sys WHERE srid >= 1000000;
......@@ -19,3 +19,23 @@ ERROR: Only KML 2 is supported
<Point><coordinates>-73.1137865115871,7.10625638610512,0</coordinates></Point>
<Point><coordinates>-73.1978481045547,6.76797715816346,0</coordinates></Point>
<Point><coordinates>-74.0775046875181,4.59620005298432,0</coordinates></Point>
ERROR: Input geometry has unknown (-1) SRID
ERROR: geometry_to_kml: 'Curve' geometry type not supported by Google Earth
ERROR: geometry_to_kml: 'CompoundString' geometry type not supported by Google Earth
ERROR: geometry_to_kml: 'Invalid type' geometry type not supported by Google Earth
ERROR: geometry_to_kml: 'Invalid type' geometry type not supported by Google Earth
ERROR: geometry_to_kml: 'Invalid type' geometry type not supported by Google Earth
ERROR: Precision out of range 1..15
ERROR: Precision out of range 1..15
ERROR: Only KML 2 is supported
<Point><coordinates>-75.5521729775749,10.4203366345305,0</coordinates></Point>
<Point><coordinates>-75.55217298,10.42033663,0</coordinates></Point>
<LineString><coordinates>-75.5884516874785,6.23081171191744,0 -75.5925764681848,6.20903425257533,0</coordinates></LineString>
<LineString><coordinates>-75.58845169,6.230811712,0 -75.59257647,6.209034253,0</coordinates></LineString>
<Polygon><outerBoundaryIs><LinearRing><coordinates>-74.042399,4.701288,0 -74.042099,4.700951,0 -74.042018,4.701012,0 -74.041835,4.700831,0 -74.041486,4.70114,0 -74.041328,4.700977,0 -74.04102,4.701245,0 -74.041178,4.701426,0 -74.040872,4.701697,0 -74.040941,4.701774,0 -74.0409,4.702606,0 -74.040824,4.702678,0 -74.041066,4.70295,0 -74.040873,4.703121,0 -74.041189,4.703468,0 -74.041383,4.703309,0 -74.041739,4.703689,0 -74.041924,4.703528,0 -74.041954,4.703555,0 -74.042307,4.703239,0 -74.042075,4.702978,0 -74.042155,4.702908,0 -74.04195,4.702675,0 -74.042096,4.702534,0 -74.042035,4.702467,0 -74.042053,4.702038,0 -74.042123,4.701974,0 -74.041986,4.701817,0 -74.042222,4.701604,0 -74.042149,4.70152,0 -74.042399,4.701288,0</coordinates></LinearRing></outerBoundaryIs></Polygon>
<Polygon><outerBoundaryIs><LinearRing><coordinates>-74.04239911,4.701288195,0 -74.04209926,4.700950994,0 -74.0420183,4.701011516,0 -74.04183483,4.700831449,0 -74.04148629,4.70114015,0 -74.04132847,4.700976981,0 -74.04101991,4.701244757,0 -74.04117774,4.701425554,0 -74.04087245,4.701697127,0 -74.04094064,4.70177368,0 -74.04089953,4.70260566,0 -74.04082413,4.702677666,0 -74.04106565,4.702949831,0 -74.04087265,4.703121095,0 -74.04118885,4.703468333,0 -74.04138265,4.703308984,0 -74.04173931,4.703688848,0 -74.0419237,4.703528239,0 -74.04195356,4.703554861,0 -74.04230658,4.703239478,0 -74.04207492,4.702978243,0 -74.0421547,4.702907817,0 -74.04195033,4.702675127,0 -74.04209558,4.702533577,0 -74.04203505,4.702466796,0 -74.04205318,4.702038078,0 -74.04212336,4.701974338,0 -74.04198589,4.701816902,0 -74.04222168,4.701604424,0 -74.04214902,4.701519996,0 -74.04239911,4.701288195,0</coordinates></LinearRing></outerBoundaryIs></Polygon>
<MultiGeometry><Point><coordinates>-74.0460345759477,4.75468700665652,0</coordinates></Point><Point><coordinates>-74.095833,4.746435,0</coordinates></Point><Point><coordinates>-74.1103754749261,4.7098754227297,0</coordinates></Point><Point><coordinates>-74.120148,4.533696,0</coordinates></Point></MultiGeometry>
<MultiGeometry><Point><coordinates>-74.04603458,4.754687007,0</coordinates></Point><Point><coordinates>-74.095833,4.746435,0</coordinates></Point><Point><coordinates>-74.11037547,4.709875423,0</coordinates></Point><Point><coordinates>-74.120148,4.533696,0</coordinates></Point></MultiGeometry>
<Point><coordinates>-73.1137865115871,7.10625638610512,0</coordinates></Point>
<Point><coordinates>-73.1978481045547,6.76797715816346,0</coordinates></Point>
<Point><coordinates>-74.0775046875181,4.59620005298432,0</coordinates></Point>
......@@ -99,4 +99,21 @@ SELECT mem_size(collect(force_4d(force_2d(geometry(wkb_ndr))))) from test_data;
SELECT mem_size(collect(force_3dm(geometry(wkb_ndr)))) from test_data;
SELECT mem_size(collect(force_2d(force_4d(force_3dm(force_3dz(force_2d(geometry(wkb_ndr)))))))) from test_data;
--
SELECT id,wkt FROM test_data WHERE
ST_asEWKT(ST_geometry(wkt)) != wkt OR
ST_asEWKT(ST_geometry(wkb_xdr)) != wkt OR
ST_asEWKT(ST_geometry(wkb_ndr)) != wkt OR
ST_asBinary(ST_geometry(wkb_ndr)) != ST_asBinary(ST_geometry(wkb_xdr)) OR
ST_asBinary(ST_geometry(wkt)) != ST_asBinary(ST_geometry(wkb_xdr));
SELECT ST_extent(ST_geometry(wkb_ndr)) from test_data;
SELECT ST_extent3d(ST_geometry(wkb_ndr)) from test_data;
SELECT ST_mem_size(ST_collect(ST_force_2d(ST_geometry(wkb_ndr)))) from test_data;
SELECT ST_mem_size(ST_collect(ST_force_3dz(ST_geometry(wkb_ndr)))) from test_data;
SELECT ST_mem_size(ST_collect(ST_force_4d(ST_force_2d(ST_geometry(wkb_ndr))))) from test_data;
SELECT ST_mem_size(ST_collect(ST_force_3dm(ST_geometry(wkb_ndr)))) from test_data;
SELECT ST_mem_size(ST_collect(ST_force_2d(ST_force_4d(ST_force_3dm(ST_force_3dz(ST_force_2d(ST_geometry(wkb_ndr)))))))) from test_data;
DROP TABLE test_data;
......@@ -5,3 +5,10 @@ BOX3D(0 0.1 -55,11 12 12)
19695
15063
10431
BOX(0 0.0999999940395355,11 12)
BOX3D(0 0.1 -55,11 12 12)
10431
15063
19695
15063
10431
select '113', area2d('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 '114', perimeter2d('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;
......@@ -15,9 +14,33 @@ select '135', distance('POINT(5 0)', 'POINT(10 12)');
select '136', distance('POINT(0 0)', translate('POINT(0 0)', 5, 12, 0));
-- postgis-users/2006-May/012174.html
select 'dist', 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
) as foo;
-- Apply the same tests using the new function names.
select '113', ST_area2d('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 '114', ST_perimeter2d('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 '115', ST_perimeter3d('MULTIPOLYGON( ((0 0 0, 10 0 0, 10 10 0, 0 10 0, 0 0 0)),( (0 0 0, 10 0 0, 10 10 0, 0 10 0, 0 0 0),(5 5 0, 7 5 0, 7 7 0, 5 7 0, 5 5 0) ) ,( (0 0 1, 10 0 1, 10 10 1, 0 10 1, 0 0 1),(5 5 1, 7 5 1, 7 7 1, 5 7 1, 5 5 1),(1 1 1,2 1 1, 2 2 1, 1 2 1, 1 1 1) ) )'::GEOMETRY) as value;
select '116', ST_length2d('MULTILINESTRING((0 0, 1 1),(0 0, 1 1, 2 2) )'::GEOMETRY) as value;
select '117', ST_length3d('MULTILINESTRING((0 0, 1 1),(0 0, 1 1, 2 2) )'::GEOMETRY) as value;
select '118', ST_length3d('MULTILINESTRING((0 0 0, 1 1 1),(0 0 0, 1 1 1, 2 2 2) )'::GEOMETRY) as value;
select '134', ST_distance('POINT(1 2)', 'POINT(1 2)');
select '135', ST_distance('POINT(5 0)', 'POINT(10 12)');
select '136', ST_distance('POINT(0 0)', ST_translate('POINT(0 0)', 5, 12, 0));
-- postgis-users/2006-May/012174.html
select 'dist', distance(a,b), distance(b,a) from (
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
......
......@@ -8,3 +8,13 @@
135|13
136|13
dist|1|1
113|291
114|140
115|140
116|4.24264068711929
117|4.24264068711929
118|5.19615242270663
134|0
135|13
136|13
dist|1|1
This diff is collapsed.
......@@ -29,3 +29,35 @@ select BdPolyFromText('MULTILINESTRING( (0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 2 4
-- SinglePolygon forming input to BdMPolyFromText
select 'BdMPolyFromText', asewkt(BdMPolyFromText('MULTILINESTRING((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2),(5 5, 5 7, 7 7, 7 5, 5 5))', 3));
-- Repeat all tests with the new function names.
-- Single 3dz polygon w/out holes
select 'BuildArea', ST_asewkt(ST_buildarea('SRID=2;LINESTRING(0 0 2, 10 0 4, 10 10 6, 0 10 8, 0 0 10)'));
-- Single 3dz polygon with holes
select 'BuildArea', ST_asewkt(ST_buildarea('SRID=3;MULTILINESTRING((0 0 2, 10 0 4, 10 10 6, 0 10 8, 0 0 10),(2 2 1, 2 4 2, 4 4 3, 4 2 4, 2 2 5),(5 5 10, 5 7 9, 7 7 8, 7 5 7, 5 5 6))'));
-- Single 3dm polygon with holes (M is currently discarded)
select 'BuildArea', ST_asewkt(ST_buildarea('SRID=3;MULTILINESTRINGM((0 0 2, 10 0 4, 10 10 6, 0 10 8, 0 0 10),(2 2 1, 2 4 2, 4 4 3, 4 2 4, 2 2 5),(5 5 10, 5 7 9, 7 7 8, 7 5 7, 5 5 6))'));
-- Single 4d polygon with holes (M is currently discarded)
select 'BuildArea', ST_asewkt(ST_buildarea('SRID=3;MULTILINESTRING((0 0 2 9, 10 0 4 9, 10 10 6 9, 0 10 8 9, 0 0 10 9),(2 2 1 9, 2 4 2 9, 4 4 3 9, 4 2 4 9, 2 2 5 9),(5 5 10 9, 5 7 9 9, 7 7 8 9, 7 5 7 9, 5 5 6 9))'));
-- Multi 4d polygon with holes (M is currently discarded)
select 'BuildArea', ST_asewkt(ST_buildarea('SRID=3;MULTILINESTRING( (0 0 2 9, 10 0 4 9, 10 10 6 9, 0 10 8 9, 0 0 10 9), (2 2 1 9, 2 4 2 9, 4 4 3 9, 4 2 4 9, 2 2 5 9), (5 5 10 9, 5 7 9 9, 7 7 8 9, 7 5 7 9, 5 5 6 9), (20 0 2 9,30 0 4 9,30 10 6 9,20 10 8 9,20 0 10 9), (22 2 1 9,22 4 2 9,24 4 3 9,24 2 4 9,22 2 5 9), (25 5 10 9,25 7 9 9,27 7 8 9,27 5 7 9,25 5 6 9))'));
-- Multi 2d polygon with holes (OGC doesn't support higher dims)
select 'BdMPolyFromText', ST_asewkt(ST_BdMPolyFromText('MULTILINESTRING( (0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 2 4, 4 4, 4 2, 2 2), (5 5, 5 7, 7 7, 7 5, 5 5), (20 0,30 0,30 10,20 10,20 0), (22 2,22 4,24 4,24 2,22 2), (25 5,25 7,27 7,27 5,25 5))', 3));
-- Single 2d polygon with holes (OGC doesn't support higher dims)
select 'BdPolyFromText', ST_asewkt(ST_BdPolyFromText('MULTILINESTRING((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2),(5 5, 5 7, 7 7, 7 5, 5 5))', 3));
-- Invalid input (not a linestring) to BdPolyFromText and BdMPolyFromText
select ST_BdPolyFromText('POINT(0 0)', 3);
select ST_BdMPolyFromText('POINT(0 0)', 3);
-- MultiPolygon forming input to BdPolyFromText
select ST_BdPolyFromText('MULTILINESTRING( (0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 2 4, 4 4, 4 2, 2 2), (5 5, 5 7, 7 7, 7 5, 5 5), (20 0,30 0,30 10,20 10,20 0), (22 2,22 4,24 4,24 2,22 2), (25 5,25 7,27 7,27 5,25 5))', 3);
-- SinglePolygon forming input to BdMPolyFromText
select 'BdMPolyFromText', ST_asewkt(ST_BdMPolyFromText('MULTILINESTRING((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2),(5 5, 5 7, 7 7, 7 5, 5 5))', 3));
......@@ -9,3 +9,14 @@ ERROR: Input is not a MultiLinestring
ERROR: Input is not a MultiLinestring
ERROR: Input returns more then a single polygon, try using BdMPolyFromText instead
BdMPolyFromText|SRID=3;MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2),(5 5,7 5,7 7,5 7,5 5)))
BuildArea|SRID=2;POLYGON((0 0 10,0 10 8,10 10 6,10 0 4,0 0 2))
BuildArea|SRID=3;POLYGON((0 0 10,0 10 8,10 10 6,10 0 4,0 0 2),(2 2 5,4 2 4,4 4 3,2 4 2,2 2 1),(5 5 6,7 5 7,7 7 8,5 7 9,5 5 10))
BuildArea|SRID=3;POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2),(5 5,7 5,7 7,5 7,5 5))
BuildArea|SRID=3;POLYGON((0 0 10,0 10 8,10 10 6,10 0 4,0 0 2),(2 2 5,4 2 4,4 4 3,2 4 2,2 2 1),(5 5 6,7 5 7,7 7 8,5 7 9,5 5 10))
BuildArea|SRID=3;MULTIPOLYGON(((0 0 10,0 10 8,10 10 6,10 0 4,0 0 2),(2 2 5,4 2 4,4 4 3,2 4 2,2 2 1),(5 5 6,7 5 7,7 7 8,5 7 9,5 5 10)),((20 0 10,20 10 8,30 10 6,30 0 4,20 0 2),(22 2 5,24 2 4,24 4 3,22 4 2,22 2 1),(25 5 6,27 5 7,27 7 8,25 7 9,25 5 10)))
BdMPolyFromText|SRID=3;MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2),(5 5,7 5,7 7,5 7,5 5)),((20 0,20 10,30 10,30 0,20 0),(22 2,24 2,24 4,22 4,22 2),(25 5,27 5,27 7,25 7,25 5)))
BdPolyFromText|SRID=3;POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2),(5 5,7 5,7 7,5 7,5 5))
ERROR: Input is not a MultiLinestring
ERROR: Input is not a MultiLinestring
ERROR: Input returns more then a single polygon, try using BdMPolyFromText instead
BdMPolyFromText|SRID=3;MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2),(5 5,7 5,7 7,5 7,5 5)))
......@@ -104,13 +104,20 @@ ERROR: parse error - invalid geometry
104|t
105|f
106|BOX3D(0 0 0,7 7 0)
106_|BOX3D(0 0 0,7 7 0)
107|POLYGON((0 0,0 7,7 7,7 0,0 0))
108|2
108_|2
109|4
109_|4
110|6
110_|6
111|528
111_|528
112|3
112_|3
121|BOX3D(1.19894826 1.20265412 0,999.932129 999.692932 0)|BOX3D(1.40486765 1.3484304 0,999.857666 999.936401 0)
121_|BOX3D(1.19894826 1.20265412 0,999.932129 999.692932 0)|BOX3D(1.40486765 1.3484304 0,999.857666 999.936401 0)
122|f
123|f
124|f
......@@ -120,24 +127,46 @@ ERROR: parse error - invalid geometry
128|f
129|34009|34009
131|1
131_|1
132|2
132_|2
133|
133_|
133a|3
133a_|3
133b|
133b_|
133c|
133c_|
133d|4
133d_|4
133e|
133e_|
137|
137_|
138|BOX3D(0 0 0,0 0 0)
138_|BOX3D(0 0 0,0 0 0)
139|SRID=2;GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY,POINT(0 0))
139_|SRID=2;GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY,POINT(0 0))
140|SRID=3;MULTIPOINT(2 2)
140_|SRID=3;MULTIPOINT(2 2)
141|SRID=4;MULTILINESTRING((2 2,3 3))
141_|SRID=4;MULTILINESTRING((2 2,3 3))
142|SRID=5;MULTILINESTRING((2 2,3 3))
142_|SRID=5;MULTILINESTRING((2 2,3 3))
143|SRID=6;MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)))
143_|SRID=6;MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)))
144|POINTM(1 2 0)
144_|POINTM(1 2 0)
145|POINT(1 2 0)
145_|POINT(1 2 0)
146|POINT(1 2 0 3)
146_|POINT(1 2 0 3)
147|POINT(1 2 3 0)
147_|POINT(1 2 3 0)
148|LINESTRING(0 0,5 0,10 0)
148_|LINESTRING(0 0,5 0,10 0)
150|SRID=6;GEOMETRYCOLLECTION(POLYGON((0 0,1 0,1 1,0 1,0 0)))
150_|SRID=6;GEOMETRYCOLLECTION(POLYGON((0 0,1 0,1 1,0 1,0 0)))
151|
151_|
......@@ -7,10 +7,10 @@
CREATE INDEX quick_gist on test using gist (the_geom gist_geometry_ops);
select num,astext(the_geom) from test where the_geom && 'BOX3D(125 125,135 135)'::box3d order by num;
select num,ST_astext(the_geom) from test where the_geom && 'BOX3D(125 125,135 135)'::box3d order by num;
set enable_seqscan = off;
select num,astext(the_geom) from test where the_geom && 'BOX3D(125 125,135 135)'::box3d order by num;
select num,ST_astext(the_geom) from test where the_geom && 'BOX3D(125 125,135 135)'::box3d order by num;
DROP TABLE test;
......@@ -53,3 +53,60 @@ select 'line_substring', asewkt(line_substring('LINESTRING(0 0 10, 1 1 5)', 0.5,
select 'line_interpolate_point', asewkt(line_interpolate_point('LINESTRING(0 0, 1 1)', 0));
select 'line_interpolate_point', asewkt(line_interpolate_point('LINESTRING(0 0 10, 1 1 5)', 0.5));
-- Repeat all tests with the new function names.
-- No M value
select '2d',ST_asewkt(ST_locate_along_measure('POINT(1 2)', 1));
select '3dz',ST_asewkt(ST_locate_along_measure('POINT(1 2 3)', 1));
-- Points
select 'PNTM_1',ST_asewkt(ST_locate_along_measure('POINTM(1 2 3)', 1));
select 'PNTM_2',ST_asewkt(ST_locate_along_measure('POINTM(1 2 3)', 3));
select 'PNTM_3',ST_asewkt(ST_locate_between_measures('POINTM(1 2 3)', 2, 3));
select 'PNTM_4',ST_asewkt(ST_locate_between_measures('POINTM(1 2 3)', 3, 4));
select 'PNTM_5',ST_asewkt(ST_locate_between_measures('POINTM(1 2 4.00001)', 3, 4));
-- Multipoints
select 'MPNT_1',ST_asewkt(ST_locate_between_measures('MULTIPOINTM(1 2 2)', 2, 5));
select 'MPNT_2', ST_asewkt(ST_locate_between_measures('MULTIPOINTM(1 2 8, 2 2 5, 2 1 0)', 2, 5));
select 'MPNT_3', ST_asewkt(ST_locate_between_measures('MULTIPOINTM(1 2 8, 2 2 5.1, 2 1 0)', 2, 5));
select 'MPNT_4', ST_asewkt(ST_locate_between_measures('MULTIPOINTM(1 2 8, 2 2 5, 2 1 0)', 4, 8));
-- Linestrings
select 'LINEZM_1', ST_asewkt(ST_locate_between_measures('LINESTRING(0 10 100 0, 0 0 0 10)', 2, 18));
select 'LINEZM_2', ST_asewkt(ST_locate_between_measures('LINESTRING(0 10 0 0, 0 0 100 10)', 2, 18));
select 'LINEZM_3', ST_asewkt(ST_locate_between_measures('LINESTRING(0 10 100 0, 0 0 0 10, 10 0 0 0)', 2, 18));
select 'LINEZM_4', ST_asewkt(ST_locate_between_measures('LINESTRING(0 10 100 0, 0 0 0 20, 10 0 0 0)', 2, 18));
select 'LINEZM_5', ST_asewkt(ST_locate_between_measures('LINESTRING(0 10 100 0, 0 0 0 20, 0 10 10 40, 10 0 0 0)', 2, 18));
select 'LINEZM_6', ST_asewkt(ST_locate_between_measures('LINESTRING(0 10 10 40, 10 0 0 0)', 2, 2));
--- line_locate_point
SELECT 'line_locate_point', ST_line_locate_point('LINESTRING(709243.393033887 163969.752725768,708943.240904444 163974.593889146,708675.634380651 163981.832927298)', 'POINT(705780 15883)');
--- postgis-users/2006-January/010613.html
select 'line_locate_point', ST_line_locate_point(ST_geomfromtext('LINESTRING(-1953743.873 471070.784,-1953735.105 471075.419,-1953720.034 471081.649)', 6269), ST_geomfromtext('POINT(-1953720.034 471081.649)', 6269));
select 'line_locate_point', ST_line_locate_point(ST_geomfromtext('LINESTRING(-1953743.873 471070.784,-1953735.105 471075.419,-1953720.034 471081.649)', 6269), ST_geomfromtext('POINT(-1953743.873 471070.784)', 6269));
--- line_substring / line_interpolate_point
--- postgis-devel/2006-January/001951.html
select 'line_substring', ST_asewkt(ST_line_substring(ST_geomfromewkt('SRID=4326;LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 3 3 3 3, 4 4 4 4)'), 0.5, 0.8));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 3 3 3 3, 4 4 4 4)', 0.5, 0.75));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0, 1 1, 2 2)', 0, 0.5));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0, 1 1, 2 2)', 0.5, 1));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0, 2 2)', 0.5, 1));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0, 2 2)', 0, 0.5));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0, 4 4)', .25, 0.5));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRINGM(0 0 0, 4 4 4)', .25, 0.5));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRINGM(0 0 4, 4 4 0)', .25, 0.5));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0 4, 4 4 0)', .25, 0.5));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0, 1 1)', 0, 0));
select 'line_substring', ST_asewkt(ST_line_substring('LINESTRING(0 0 10, 1 1 5)', 0.5, .5));
--- line_interpolate_point
select 'line_interpolate_point', ST_asewkt(ST_line_interpolate_point('LINESTRING(0 0, 1 1)', 0));
select 'line_interpolate_point', ST_asewkt(ST_line_interpolate_point('LINESTRING(0 0 10, 1 1 5)', 0.5));
......@@ -32,3 +32,37 @@ line_substring|POINT(0 0)
line_substring|POINT(0.5 0.5 7.5)
line_interpolate_point|POINT(0 0)
line_interpolate_point|POINT(0.5 0.5 7.5)
2d|
3dz|
PNTM_1|GEOMETRYCOLLECTIONM EMPTY
PNTM_2|POINTM(1 2 3)
PNTM_3|POINTM(1 2 3)
PNTM_4|POINTM(1 2 3)
PNTM_5|GEOMETRYCOLLECTIONM EMPTY
MPNT_1|GEOMETRYCOLLECTIONM(POINT(1 2 2))
MPNT_2|GEOMETRYCOLLECTIONM(POINT(2 2 5))
MPNT_3|GEOMETRYCOLLECTIONM EMPTY
MPNT_4|GEOMETRYCOLLECTIONM(POINT(1 2 8),POINT(2 2 5))
LINEZM_1|LINESTRING(0 8 80 2,0 0 0 10)
LINEZM_2|LINESTRING(0 8 20 2,0 0 100 10)
LINEZM_3|LINESTRING(0 8 80 2,0 0 0 10,8 0 0 2)
LINEZM_4|GEOMETRYCOLLECTION(LINESTRING(0 9 90 2,0 1 10 18),LINESTRING(1 0 0 18,9 0 0 2))
LINEZM_5|GEOMETRYCOLLECTION(LINESTRING(0 9 90 2,0 1 10 18),LINESTRING(5.5 4.5 4.5 18,9.5 0.5 0.5 2))
LINEZM_6|POINT(9.5 0.5 0.5 2)
line_locate_point|0.528602749909894
line_locate_point|1
line_locate_point|0
line_substring|SRID=4326;LINESTRING(2 2 2 2,3 3 3 3,3.2 3.2 3.2 3.2)
line_substring|LINESTRING(2 2 2 2,3 3 3 3)
line_substring|LINESTRING(0 0,1 1)
line_substring|LINESTRING(1 1,2 2)
line_substring|LINESTRING(1 1,2 2)
line_substring|LINESTRING(0 0,1 1)
line_substring|LINESTRING(1 1,2 2)
line_substring|LINESTRINGM(1 1 1,2 2 2)
line_substring|LINESTRINGM(1 1 3,2 2 2)
line_substring|LINESTRING(1 1 3,2 2 2)
line_substring|POINT(0 0)
line_substring|POINT(0.5 0.5 7.5)
line_interpolate_point|POINT(0 0)
line_interpolate_point|POINT(0.5 0.5 7.5)
This diff is collapsed.
......@@ -74,3 +74,77 @@ linemerge149|LINESTRING(-5 -5,0 0,1 1,4 4)
intersects|f
NOTICE: IllegalArgumentException: Number of points must be 0 or >3
ERROR: POSTGIS2GEOS conversion failed
buffer|POLYGON((1 0,0.707107 -0.707107,0 -1,-0.707107 -0.707107,-1 0,-0.707107 0.707107,0 1,0.707107 0.707107,1 0))
geomunion|MULTIPOINT(0 0,1 1)
unite_garray|t
convexhull|POLYGON((0 0,0 10,10 10,10 0,0 0))
relate|F0FFFF102
relate|t
relate|f
disjoint|f
touches|t
intersects|t
crosses|f
crosses|t
within100|t
within101|f
within102|f
within103|f
within104|f
within105|t
within106|t
disjoint100|f
disjoint101|f
disjoint102|t
disjoint103|f
disjoint104|t
disjoint105|f
disjoint106|t
disjoint150|f
disjoint151|f
disjoint152|t
disjoint153|f
disjoint154|t
disjoint155|f
disjoint156|t
intersects100|t
intersects101|t
intersects102|f
intersects103|t
intersects104|f
intersects105|t
intersects106|f
intersects150|t
intersects151|t
intersects152|f
intersects153|t
intersects154|f
intersects155|t
intersects156|f
contains100|t
contains101|f
contains102|f
contains103|f
contains104|f
contains105|t
contains106|t
within119|f
within120|f
overlaps|f
isvalid|t
NOTICE: Self-intersection
isvalid|f
isvalid|t
intersection|POINT(0 0)
difference|MULTILINESTRING((0 10,0 2),(0 -2,0 -10))
boundary|MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2))
symdifference|GEOMETRYCOLLECTION(LINESTRING(2 2,4 4),LINESTRING(10 10,20 20),POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,2 4,2 2,4 2,4 4)))
issimple|t
equals|t
pointonsurface|POINT(5 5)
centroid|POINT(5.08333333333333 5.08333333333333)
exteriorring|LINESTRING(52 18,66 23,73 9,48 6,52 18)
polygonize_garray|GEOMETRYCOLLECTION EMPTY
polygonize_garray|POLYGON((10 0,0 0,0 10,10 10,10 0))
linemerge149|LINESTRING(-5 -5,0 0,1 1,4 4)
intersects|f
......@@ -35,5 +35,33 @@ SELECT transform(GeomFromEWKT('SRID=-1;POINT(0 0)'),1000002);
--- test #8: Transforming to same SRID
SELECT 8,AsEWKT(transform(GeomFromEWKT('SRID=1000002;POINT(0 0)'),1000002));
-- Repeat all tests with the new function names.
--- test #0: NULL values
SELECT 0,coalesce(ST_AsText(ST_transform(NULL, 1000001)),'EMPTY');
--- test #1: a simple projection
SELECT 1,ST_AsEWKT(ST_SnapToGrid(ST_transform(ST_GeomFromEWKT('SRID=1000002;POINT(16 48)'),1000001),10));
--- test #2: same in 3D
SELECT 2,ST_AsEWKT(ST_SnapToGrid(ST_transform(ST_GeomFromEWKT('SRID=1000002;POINT(16 48 171)'),1000001),10));
--- test #3: same in 4D
SELECT 3,ST_AsEWKT(ST_SnapToGrid(ST_transform(ST_GeomFromEWKT('SRID=1000002;POINT(16 48 171 -500)'),1000001),10));
--- test #4: LINESTRING projection, 2 points
SELECT 4,ST_AsEWKT(ST_SnapToGrid(ST_transform(ST_GeomFromEWKT('SRID=1000002;LINESTRING(16 48, 16 49)'),1000001),10));
--- test #5: LINESTRING projection, 2 points, 4D
SELECT 5,ST_AsEWKT(ST_SnapToGrid(ST_transform(ST_GeomFromEWKT('SRID=1000002;LINESTRING(16 48 0 0, 16 49 0 0)'),1000001),10));
--- test #6: re-projecting a projected value
SELECT 6,round(ST_X(ST_transform(ST_transform(ST_GeomFromEWKT('SRID=1000002;POINT(16 48)'),1000001), 1000002))::numeric,8),round(ST_Y(ST_transform(ST_transform(ST_GeomFromEWKT('SRID=1000002;POINT(16 48)'),1000001), 1000002))::numeric,8);
--- test #7: Should yield an error since input SRID is unknown
SELECT ST_transform(ST_GeomFromEWKT('SRID=-1;POINT(0 0)'),1000002);
--- test #8: Transforming to same SRID
SELECT 8,ST_AsEWKT(ST_transform(ST_GeomFromEWKT('SRID=1000002;POINT(0 0)'),1000002));
DELETE FROM spatial_ref_sys WHERE srid >= 1000000;
......@@ -7,3 +7,12 @@
6|16.00000000|48.00000000
ERROR: Input geometry has unknown (-1) SRID
8|SRID=1000002;POINT(0 0)
0|EMPTY
1|SRID=1000001;POINT(574600 5316780)
2|SRID=1000001;POINT(574600 5316780 171)
3|SRID=1000001;POINT(574600 5316780 171 -500)
4|SRID=1000001;LINESTRING(574600 5316780,573140 5427940)
5|SRID=1000001;LINESTRING(574600 5316780 0 0,573140 5427940 0 0)
6|16.00000000|48.00000000
ERROR: Input geometry has unknown (-1) SRID
8|SRID=1000002;POINT(0 0)
......@@ -21,4 +21,28 @@ SELECT asewkt(removepoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2)', 2));
SELECT asewkt(removepoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 3 3 3 3, 4 4 4 4, 5 5 5 5, 6 6 6 6, 7 7 7 7)', 2));
SELECT asewkt(removepoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 3 3 3 3, 4 4 4 4, 5 5 5 5, 6 6 6 6, 7 7 7 7)', 4));
-- Repeat tests for new function names.
-- Can't remove points from a 2-point linestring
SELECT ST_removepoint('LINESTRING(0 0, 1 1)', 0);
-- Out of range indexes
SELECT ST_removepoint('LINESTRING(0 0, 1 1, 2 2)', 3);
SELECT ST_removepoint('LINESTRING(0 0, 1 1, 2 2)', -1);
-- Removing first/last points
SELECT ST_asewkt(ST_removepoint('LINESTRING(0 0, 1 1, 2 2)', 0));
SELECT ST_asewkt(ST_removepoint('LINESTRING(0 0, 1 1, 2 2)', 2));
-- Removing first/last points with higher dimension
SELECT ST_asewkt(ST_removepoint('LINESTRING(0 0 0, 1 1 1, 2 2 2)', 0));
SELECT ST_asewkt(ST_removepoint('LINESTRING(0 0 0, 1 1 1, 2 2 2)', 2));
SELECT ST_asewkt(ST_removepoint('LINESTRINGM(0 0 0, 1 1 1, 2 2 2)', 0));
SELECT ST_asewkt(ST_removepoint('LINESTRINGM(0 0 0, 1 1 1, 2 2 2)', 2));
SELECT ST_asewkt(ST_removepoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2)', 0));
SELECT ST_asewkt(ST_removepoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2)', 2));