Commit 1375e2dd authored by Paul Ramsey's avatar Paul Ramsey

Implement RFC3 (#195)


git-svn-id: http://svn.osgeo.org/postgis/trunk@4750 b70326c6-7e19-0410-871a-916f4a2858ee
parent f84d44da
......@@ -58,6 +58,8 @@ Datum LWGEOM_reverse(PG_FUNCTION_ARGS);
Datum LWGEOM_forceRHR_poly(PG_FUNCTION_ARGS);
Datum LWGEOM_noop(PG_FUNCTION_ARGS);
Datum LWGEOM_zmflag(PG_FUNCTION_ARGS);
Datum LWGEOM_hasz(PG_FUNCTION_ARGS);
Datum LWGEOM_hasm(PG_FUNCTION_ARGS);
Datum LWGEOM_ndims(PG_FUNCTION_ARGS);
Datum LWGEOM_makepoint(PG_FUNCTION_ARGS);
Datum LWGEOM_makepoint3dm(PG_FUNCTION_ARGS);
......@@ -2686,6 +2688,21 @@ Datum LWGEOM_zmflag(PG_FUNCTION_ARGS)
PG_RETURN_INT16(ret);
}
PG_FUNCTION_INFO_V1(LWGEOM_hasz);
Datum LWGEOM_hasz(PG_FUNCTION_ARGS)
{
PG_LWGEOM *in = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
PG_RETURN_BOOL(TYPE_HASZ(in->type));
}
PG_FUNCTION_INFO_V1(LWGEOM_hasm);
Datum LWGEOM_hasm(PG_FUNCTION_ARGS)
{
PG_LWGEOM *in = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
PG_RETURN_BOOL(TYPE_HASM(in->type));
}
PG_FUNCTION_INFO_V1(LWGEOM_hasBBOX);
Datum LWGEOM_hasBBOX(PG_FUNCTION_ARGS)
{
......
This diff is collapsed.
......@@ -156,37 +156,17 @@ CREATE OR REPLACE FUNCTION ST_OrderingEquals(geometry, geometry)
$$
LANGUAGE 'SQL' IMMUTABLE STRICT;
-- PostGIS equivalent function: zmflag(geometry)
-- Availability: 1.5.0
CREATE OR REPLACE FUNCTION SE_Is3D(geometry)
RETURNS boolean
AS $$
SELECT CASE ST_zmflag($1)
WHEN 0 THEN false
WHEN 1 THEN false
WHEN 2 THEN true
WHEN 3 THEN true
ELSE false
END
$$
LANGUAGE 'SQL' IMMUTABLE STRICT;
RETURNS bool
AS 'MODULE_PATHNAME', 'LWGEOM_hasz'
LANGUAGE 'C' IMMUTABLE STRICT;
-- PostGIS equivalent function: zmflag(geometry)
-- Availability: 1.5.0
CREATE OR REPLACE FUNCTION SE_IsMeasured(geometry)
RETURNS boolean
AS $$
SELECT CASE ST_zmflag($1)
WHEN 0 THEN false
WHEN 1 THEN true
WHEN 2 THEN false
WHEN 3 THEN true
ELSE false
END
$$
LANGUAGE 'SQL' IMMUTABLE STRICT;
RETURNS bool
AS 'MODULE_PATHNAME', 'LWGEOM_hasm'
LANGUAGE 'C' IMMUTABLE STRICT;
-------------------------------------------------------------------------------
-- SQL/MM (ArcSDE subset) - SQL Functions on type ST_Point
......
......@@ -262,8 +262,5 @@ select '149', ST_astext(segmentize('GEOMETRYCOLLECTION EMPTY', 0.5));
select '150', ST_asewkt(ST_force_collection(ST_setsrid('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::geometry, 6)));
select '150_', asewkt(force_collection(setsrid('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::geometry, 6)));
select '151', ST_geom_accum(NULL, NULL);
select '151_', geom_accum(NULL, NULL);
-- Drop test table
DROP table test;
......@@ -183,5 +183,3 @@ HINT: "MULTIPOINT(1 1, 2 2" <-- parse error at position 19 within geometry
149|GEOMETRYCOLLECTION EMPTY
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_|
......@@ -10,7 +10,6 @@ SELECT 'buffer', astext(SnapToGrid(buffer('POINT(0 0)', 1, '2'), 1.0e-6));
SELECT 'buffer', astext(SnapToGrid(buffer('POINT(0 0)', 1, '3'), 1.0e-6));
SELECT 'geomunion', astext(geomunion('POINT(0 0)', 'POINT(1 1)'));
SELECT 'unite_garray', equals(unite_garray(geom_accum('{POINT(0 0)}', 'POINT(2 3)')), 'MULTIPOINT(2 3,0 0)');
SELECT 'convexhull', asewkt(convexhull('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2))'));
SELECT 'relate', relate('POINT(0 0)', 'LINESTRING(0 0, 1 1)');
SELECT 'relate', relate('POINT(0 0)', 'LINESTRING(0 0, 1 1)', 'F0FFFF*02');
......@@ -132,13 +131,10 @@ select 'intersects', intersects(
polygonfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))')
);
select '130', geosnoop('POLYGON((0 0, 1 1, 0 0))');
-- Repeat all tests with new function names.
SELECT 'buffer', ST_astext(ST_SnapToGrid(ST_buffer('POINT(0 0)', 1, 2), 1.0e-6));
SELECT 'geomunion', ST_astext(ST_union('POINT(0 0)', 'POINT(1 1)'));
SELECT 'unite_garray', ST_equals(ST_unite_garray(ST_geom_accum('{POINT(0 0)}', 'POINT(2 3)')), 'MULTIPOINT(2 3,0 0)');
SELECT 'convexhull', ST_asewkt(ST_convexhull('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2))'));
SELECT 'relate', ST_relate('POINT(0 0)', 'LINESTRING(0 0, 1 1)');
SELECT 'relate', ST_relate('POINT(0 0)', 'LINESTRING(0 0, 1 1)', 'F0FFFF*02');
......
......@@ -2,7 +2,6 @@ buffer|POLYGON((1 0,0.707107 -0.707107,0 -1,-0.707107 -0.707107,-1 0,-0.707107 0
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))
buffer|POLYGON((1 0,0.866025 -0.5,0.5 -0.866025,0 -1,-0.5 -0.866025,-0.866025 -0.5,-1 0,-0.866025 0.5,-0.5 0.866025,0 1,0.5 0.866025,0.866025 0.5,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
......@@ -74,11 +73,8 @@ 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
ERROR: geometry requires more points
HINT: "POLYGON((0 0, 1 1, 0 0)" <-- parse error at position 23 within geometry
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment