Change "no SRID" SRID to 0 (#286)

git-svn-id: http://svn.osgeo.org/postgis/trunk@7912 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Paul Ramsey 2011-09-28 23:38:56 +00:00
parent 04eda6922a
commit afa9374199
24 changed files with 70 additions and 279 deletions

View file

@ -1286,13 +1286,13 @@ ERROR: Two or more edges found</programlisting>
<title>Examples</title>
<para>These examples use edges faces created in <xref linkend="AddFace" /></para>
<programlisting>SELECT topology.GetFaceByPoint('ma_topo',geom, 10) As with1mtol, topology.GetFaceByPoint('ma_topo',geom,0) As withnotol
FROM ST_GeomFromEWKT('SRID=-1;POINT(234604.6 899382.0)') As geom;
FROM ST_GeomFromEWKT('SRID=0;POINT(234604.6 899382.0)') As geom;
with1mtol | withnotol
-----------+-----------
1 | 0</programlisting>
<programlisting>SELECT topology.GetFaceByPoint('ma_topo',geom, 1) As nearnode
FROM ST_GeomFromEWKT('SRID=-1;POINT(227591.9 893900.4)') As geom;
FROM ST_GeomFromEWKT('SRID=0;POINT(227591.9 893900.4)') As geom;
-- get error --
ERROR: Two or more faces found</programlisting>

View file

@ -39,8 +39,8 @@ static int init_cg_suite(void)
{
pa21 = ptarray_construct(0, 0, 2);
pa22 = ptarray_construct(0, 0, 2);
l21 = lwline_construct(-1, NULL, pa21);
l22 = lwline_construct(-1, NULL, pa22);
l21 = lwline_construct(SRID_UNKNOWN, NULL, pa21);
l22 = lwline_construct(SRID_UNKNOWN, NULL, pa22);
return 0;
}

View file

@ -89,7 +89,7 @@ static void test_gbox_from_spherical_coordinates(void)
pa = ptarray_construct_reference_data(0, 0, 2, (uint8_t*)ll);
lwline = lwline_as_lwgeom(lwline_construct(-1, 0, pa));
lwline = lwline_as_lwgeom(lwline_construct(SRID_UNKNOWN, 0, pa));
FLAGS_SET_GEODETIC(lwline->flags, 1);
srandomdev();

View file

@ -35,7 +35,7 @@ static void test_typmod_macros(void)
rv = TYPMOD_GET_SRID(typmod);
CU_ASSERT_EQUAL(rv, srid);
srid = -1;
srid = SRID_UNKNOWN;
TYPMOD_SET_SRID(typmod,srid);
rv = TYPMOD_GET_SRID(typmod);
CU_ASSERT_EQUAL(rv, srid);
@ -110,7 +110,7 @@ static void test_serialized_srid(void)
//printf("srid=%d rv=%d\n",srid,rv);
CU_ASSERT_EQUAL(rv, srid);
srid = -1;
srid = SRID_UNKNOWN;
gserialized_set_srid(&s, srid);
rv = gserialized_get_srid(&s);
CU_ASSERT_EQUAL(rv, srid);
@ -489,7 +489,7 @@ static void test_lwgeom_flip_coordinates(void)
);
do_lwgeom_flip_coordinates(
"SRID=-1;POINT(1 2)",
"SRID=0;POINT(1 2)",
"POINT(2 1)"
);
}

View file

@ -1,9 +0,0 @@
#
# liblwgeom examples Makefile
#
all:
gcc -I../ -o unparser unparser.c ../liblwgeom.a -lm
clean:
rm -f unparser

View file

@ -1,7 +0,0 @@
liblwgeom API examples
======================
This directory contains examples of how to use the liblwgeom API from other C programs. Since liblwgeom is a static library, it is currently limited to tools within the PostGIS source tree. However, it is envisaged that programmers may make use of this interface to produce other geometry processing tools that can input and output WKT and WKB (which is, of course, easily loadable into PostGIS).
Mark.

View file

@ -1,191 +0,0 @@
/**********************************************************************
* $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
* Copyright 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
*
**********************************************************************/
#include <stdio.h>
#include <math.h>
#include "liblwgeom_internal.h"
void lwgeom_init_allocators()
{
/*
* Any program linked into liblwgeom *MUST* have a function called lwgeom_init_allocators()
* defined. The first time that a memory allocation is required, liblwgeom calls this function
* to enable the user to setup their own functions for lwalloc/lwfree. Hence when being called
* from PostGIS we can ensure we use palloc/pfree for all memory requests rather than the
* system memory management calls.
*
* Since using the standard malloc/free is likely to be a common option, liblwgeom contains a
* function called lwgeom_install_default_allocators() which sets this up for you. Hence most
* people will only ever need this line within their lwgeom_init_allocations() function.
*/
lwgeom_install_default_allocators();
}
int main()
{
/*
* An example to show how to call the WKT/WKB unparsers in liblwgeom
*/
LWGEOM_UNPARSER_RESULT lwg_unparser_result;
int result;
LWGEOM *lwgeom;
uint8_t *serialized_lwgeom;
POINTARRAY *dpa;
POINT4D point4d;
POINTARRAY **rings;
LWPOINT *testpoint;
LWLINE *testline;
LWPOLY *testpoly;
/*
* Construct a geometry equivalent to POINT(0 51)
*/
dpa = ptarray_construct_empty(0, 0, 2);
point4d.x = 0;
point4d.y = 51;
ptarray_append_point(dpa, &point4d, LW_FALSE);
testpoint = lwpoint_construct(-1, NULL, dpa);
/* Generate the LWGEOM from LWPOINT, then serialize it ready for the parser */
lwgeom = lwpoint_as_lwgeom(testpoint);
serialized_lwgeom = lwgeom_serialize(lwgeom);
/* Output the geometry in WKT and WKB */
result = serialized_lwgeom_to_ewkt(&lwg_unparser_result, serialized_lwgeom, PARSER_CHECK_ALL);
printf("WKT format : %s\n", lwg_unparser_result.wkoutput);
result = serialized_lwgeom_to_hexwkb(&lwg_unparser_result, serialized_lwgeom, PARSER_CHECK_ALL, NDR);
printf("HEXWKB format : %s\n\n", lwg_unparser_result.wkoutput);
/* Free all of the allocated items */
lwfree(lwg_unparser_result.wkoutput);
lwfree(serialized_lwgeom);
lwpoint_free(testpoint);
/*
* Construct a geometry equivalent to LINESTRING(0 0, 2 2, 4 1)
*/
dpa = ptarray_construct_empty(0, 0, 2);
point4d.x = 0;
point4d.y = 0;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 2;
point4d.y = 2;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 4;
point4d.y = 1;
ptarray_append_point(dpa, &point4d, LW_FALSE);
testline = lwline_construct(-1, NULL, dpa);
/* Generate the LWGEOM from LWLINE, then serialize it ready for the parser */
lwgeom = lwline_as_lwgeom(testline);
serialized_lwgeom = lwgeom_serialize(lwgeom);
/* Output the geometry in WKT and WKB */
result = serialized_lwgeom_to_ewkt(&lwg_unparser_result, serialized_lwgeom, PARSER_CHECK_ALL);
printf("WKT format : %s\n", lwg_unparser_result.wkoutput);
result = serialized_lwgeom_to_hexwkb(&lwg_unparser_result, serialized_lwgeom, PARSER_CHECK_ALL, NDR);
printf("HEXWKB format : %s\n\n", lwg_unparser_result.wkoutput);
/* Free all of the allocated items */
lwfree(lwg_unparser_result.wkoutput);
lwfree(serialized_lwgeom);
lwline_free(testline);
/*
* Construct a geometry equivalent to POLYGON((0 0, 0 10, 10 10, 10 0, 0 0)(3 3, 3 6, 6 6, 6 3, 3 3))
*/
/* Allocate memory for the rings */
rings = lwalloc(sizeof(POINTARRAY) * 2);
/* Construct the first ring */
dpa = ptarray_construct_empty(0, 0, 2);
point4d.x = 0;
point4d.y = 0;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 0;
point4d.y = 10;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 10;
point4d.y = 10;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 10;
point4d.y = 0;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 0;
point4d.y = 0;
ptarray_append_point(dpa, &point4d, LW_FALSE);
rings[0] = dpa;
/* Construct the second ring */
dpa = ptarray_construct_empty(0, 0, 2);
point4d.x = 3;
point4d.y = 3;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 3;
point4d.y = 6;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 6;
point4d.y = 6;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 6;
point4d.y = 3;
ptarray_append_point(dpa, &point4d, LW_FALSE);
point4d.x = 3;
point4d.y = 3;
ptarray_append_point(dpa, &point4d, LW_FALSE);
rings[1] = dpa;
testpoly = lwpoly_construct(-1, NULL, 2, rings);
/* Generate the LWGEOM from LWPOLY, then serialize it ready for the parser */
lwgeom = lwpoly_as_lwgeom(testpoly);
serialized_lwgeom = lwgeom_serialize(lwgeom);
/* Output the geometry in WKT and WKB */
result = serialized_lwgeom_to_ewkt(&lwg_unparser_result, serialized_lwgeom, PARSER_CHECK_NONE);
printf("WKT format : %s\n", lwg_unparser_result.wkoutput);
result = serialized_lwgeom_to_hexwkb(&lwg_unparser_result, serialized_lwgeom, PARSER_CHECK_NONE, NDR);
printf("HEXWKB format : %s\n\n", lwg_unparser_result.wkoutput);
/* Free all of the allocated items */
lwfree(lwg_unparser_result.wkoutput);
lwfree(serialized_lwgeom);
lwpoly_free(testpoly);
}

View file

@ -145,7 +145,7 @@
* Currently we are using 20 bits (1048575) of storage for SRID.
*/
#define SRID_MAXIMUM 999999
#define SRID_UNKNOWN -1
#define SRID_UNKNOWN 0
/**
* Global functions for memory/logging handlers.

View file

@ -1359,7 +1359,7 @@ int lwgeom_is_empty(const LWGEOM *geom)
int lwgeom_has_srid(const LWGEOM *geom)
{
if ( (int)(geom->srid) > 0 )
if ( geom->srid != SRID_UNKNOWN )
return LW_TRUE;
return LW_FALSE;

View file

@ -189,8 +189,8 @@ lwline_split_by_point(const LWLINE* lwline_in, const LWPOINT* blade_in)
/* TODO: check if either pa1 or pa2 are empty ? */
components[0] = (LWGEOM*)lwline_construct(-1, NULL, pa1);
components[1] = (LWGEOM*)lwline_construct(-1, NULL, pa2);
components[0] = (LWGEOM*)lwline_construct(SRID_UNKNOWN, NULL, pa1);
components[1] = (LWGEOM*)lwline_construct(SRID_UNKNOWN, NULL, pa2);
++ncomponents;
}
while (0);

View file

@ -209,7 +209,6 @@ static void lwtype_from_wkb_state(wkb_parse_state *s, uint32_t wkb_type)
}
LWDEBUGF(4,"Got lwtype %s (%u)", lwtype_name(s->lwtype), s->lwtype);
LWDEBUGF(4,"s->has_srid=%d s->srid=%d", s->has_srid, s->srid);
return;
}

View file

@ -126,7 +126,8 @@ static uint32_t lwgeom_wkb_type(const LWGEOM *geom, uint8_t variant)
wkb_type |= WKBZOFFSET;
if ( FLAGS_GET_M(geom->flags) )
wkb_type |= WKBMOFFSET;
if ( geom->srid != SRID_UNKNOWN && ! (variant & WKB_NO_SRID) )
/* if ( geom->srid != SRID_UNKNOWN && ! (variant & WKB_NO_SRID) ) */
if ( lwgeom_wkb_needs_srid(geom, variant) )
wkb_type |= WKBSRIDFLAG;
}
else if ( variant & WKB_ISO )

View file

@ -2077,17 +2077,17 @@ Datum LWGEOM_makepoint(PG_FUNCTION_ARGS)
x = PG_GETARG_FLOAT8(0);
y = PG_GETARG_FLOAT8(1);
if ( PG_NARGS() == 2 ) point = lwpoint_make2d(-1, x, y);
if ( PG_NARGS() == 2 ) point = lwpoint_make2d(SRID_UNKNOWN, x, y);
else if ( PG_NARGS() == 3 )
{
z = PG_GETARG_FLOAT8(2);
point = lwpoint_make3dz(-1, x, y, z);
point = lwpoint_make3dz(SRID_UNKNOWN, x, y, z);
}
else if ( PG_NARGS() == 4 )
{
z = PG_GETARG_FLOAT8(2);
m = PG_GETARG_FLOAT8(3);
point = lwpoint_make4d(-1, x, y, z, m);
point = lwpoint_make4d(SRID_UNKNOWN, x, y, z, m);
}
else
{
@ -2114,7 +2114,7 @@ Datum LWGEOM_makepoint3dm(PG_FUNCTION_ARGS)
y = PG_GETARG_FLOAT8(1);
m = PG_GETARG_FLOAT8(2);
point = lwpoint_make3dm(-1, x, y, m);
point = lwpoint_make3dm(SRID_UNKNOWN, x, y, m);
result = pglwgeom_serialize((LWGEOM *)point);
PG_RETURN_POINTER(result);

View file

@ -88,7 +88,7 @@ Datum geom_from_gml(PG_FUNCTION_ARGS)
LWGEOM *lwgeom;
int xml_size;
char *xml;
int root_srid;
int root_srid=0;
bool hasz=true;
xmlNodePtr xmlroot=NULL;
@ -99,6 +99,7 @@ Datum geom_from_gml(PG_FUNCTION_ARGS)
xml = text2cstring(xml_input);
xml_size = VARSIZE(xml_input) - VARHDRSZ;
/* Zero for undefined */
root_srid = PG_GETARG_INT32(1);
/* Begin to Parse XML doc */
@ -114,7 +115,8 @@ Datum geom_from_gml(PG_FUNCTION_ARGS)
lwgeom = parse_gml(xmlroot, &hasz, &root_srid);
lwgeom_add_bbox(lwgeom);
if (root_srid && lwgeom->srid == -1) lwgeom->srid = root_srid;
if ( root_srid )
lwgeom->srid = root_srid;
xmlFreeDoc(xmldoc);
xmlCleanupParser();
@ -979,7 +981,7 @@ static LWGEOM* parse_gml_point(xmlNodePtr xnode, bool *hasz, int *root_srid)
{
if (srs->srid != *root_srid)
gml_reproject_pa(pa, srs->srid, *root_srid);
geom = (LWGEOM *) lwpoint_construct(-1, NULL, pa);
geom = (LWGEOM *) lwpoint_construct(SRID_UNKNOWN, NULL, pa);
}
lwfree(srs);
@ -1013,7 +1015,7 @@ static LWGEOM* parse_gml_line(xmlNodePtr xnode, bool *hasz, int *root_srid)
{
if (srs->srid != *root_srid)
gml_reproject_pa(pa, srs->srid, *root_srid);
geom = (LWGEOM *) lwline_construct(-1, NULL, pa);
geom = (LWGEOM *) lwline_construct(SRID_UNKNOWN, NULL, pa);
}
lwfree(srs);
@ -1125,7 +1127,7 @@ static LWGEOM* parse_gml_curve(xmlNodePtr xnode, bool *hasz, int *root_srid)
{
if (srs->srid != *root_srid)
gml_reproject_pa(pa, srs->srid, *root_srid);
geom = (LWGEOM *) lwline_construct(-1, NULL, pa);
geom = (LWGEOM *) lwline_construct(SRID_UNKNOWN, NULL, pa);
}
lwfree(srs);
@ -1164,7 +1166,7 @@ static LWGEOM* parse_gml_linearring(xmlNodePtr xnode, bool *hasz, int *root_srid
else
{
if (srs->srid != *root_srid) gml_reproject_pa(ppa[0], srs->srid, *root_srid);
geom = (LWGEOM *) lwpoly_construct(-1, NULL, 1, ppa);
geom = (LWGEOM *) lwpoly_construct(SRID_UNKNOWN, NULL, 1, ppa);
}
lwfree(srs);
@ -1257,7 +1259,7 @@ static LWGEOM* parse_gml_polygon(xmlNodePtr xnode, bool *hasz, int *root_srid)
for (i=0 ; i < ring ; i++)
gml_reproject_pa(ppa[i], srs->srid, *root_srid);
}
geom = (LWGEOM *) lwpoly_construct(-1, NULL, ring, ppa);
geom = (LWGEOM *) lwpoly_construct(SRID_UNKNOWN, NULL, ring, ppa);
}
lwfree(srs);
@ -1329,7 +1331,7 @@ static LWGEOM* parse_gml_triangle(xmlNodePtr xnode, bool *hasz, int *root_srid)
if (srs->srid != *root_srid)
gml_reproject_pa(pa, srs->srid, *root_srid);
geom = (LWGEOM *) lwtriangle_construct(-1, NULL, pa);
geom = (LWGEOM *) lwtriangle_construct(SRID_UNKNOWN, NULL, pa);
}
lwfree(srs);
@ -1434,7 +1436,7 @@ static LWGEOM* parse_gml_patch(xmlNodePtr xnode, bool *hasz, int *root_srid)
for (i=0 ; i < ring ; i++)
gml_reproject_pa(ppa[i], srs->srid, *root_srid);
}
geom = (LWGEOM *) lwpoly_construct(-1, NULL, ring, ppa);
geom = (LWGEOM *) lwpoly_construct(SRID_UNKNOWN, NULL, ring, ppa);
}
lwfree(srs);

View file

@ -288,21 +288,17 @@ Datum LWGEOM_to_text(PG_FUNCTION_ARGS)
char *hexwkb;
size_t hexwkb_size;
text *result;
size_t text_size;
/* Generate WKB hex text */
lwgeom = pglwgeom_deserialize(geom);
hexwkb = lwgeom_to_hexwkb(lwgeom, WKB_EXTENDED, &hexwkb_size);
lwgeom_free(lwgeom);
/* Prepare the PgSQL text return type, which doesn't include a null terminator */
text_size = hexwkb_size-1+VARHDRSZ;
result = palloc(text_size);
memcpy(VARDATA(result), hexwkb, hexwkb_size-1);
SET_VARSIZE(result, text_size);
/* Copy into text obect */
result = cstring2text(hexwkb);
pfree(hexwkb);
/* Clean up and return */
pfree(hexwkb);
PG_FREE_IF_COPY(geom, 0);
PG_RETURN_TEXT_P(result);
}

View file

@ -135,7 +135,7 @@ RTREE_NODE *createLeafNode(POINTARRAY *pa, int startPoint)
value2 = tmp.y;
ptarray_append_point(npa,&tmp,LW_TRUE);
line = lwline_construct(-1, NULL, npa);
line = lwline_construct(SRID_UNKNOWN, NULL, npa);
parent = lwalloc(sizeof(RTREE_NODE));
parent->interval = createInterval(value1, value2);
@ -265,7 +265,7 @@ LWMLINE *findLineSegments(RTREE_NODE *root, double value)
POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", root->segment, root->segment->type, FLAGS_GET_Z(root->segment->flags));
result = (LWMLINE *)lwcollection_construct(lwgeom_makeType_full(0, 0, 0, MULTILINETYPE, 0), -1, NULL, 1, lwgeoms);
result = (LWMLINE *)lwcollection_construct(lwgeom_makeType_full(0, 0, 0, MULTILINETYPE, 0), SRID_UNKNOWN, NULL, 1, lwgeoms);
}
/* If there is a left child node, recursively include its results. */
@ -326,7 +326,7 @@ LWMLINE *mergeMultiLines(LWMLINE *line1, LWMLINE *line2)
{
geoms[j] = lwgeom_clone((LWGEOM *)line2->geoms[i]);
}
col = lwcollection_construct(MULTILINETYPE, -1, NULL, ngeoms, geoms);
col = lwcollection_construct(MULTILINETYPE, SRID_UNKNOWN, NULL, ngeoms, geoms);
POSTGIS_DEBUGF(3, "mergeMultiLines returning %p, %d, %d", col, col->ngeoms, col->type);

View file

@ -43,15 +43,15 @@ Datum transform(PG_FUNCTION_ARGS)
result_srid = PG_GETARG_INT32(1);
if (result_srid == SRID_UNKNOWN)
{
elog(ERROR,"-1 is an invalid target SRID");
elog(ERROR,"%d is an invalid target SRID",SRID_UNKNOWN);
PG_RETURN_NULL();
}
geom = (PG_LWGEOM *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
if (pglwgeom_get_srid(geom) == -1)
if (pglwgeom_get_srid(geom) == SRID_UNKNOWN)
{
PG_FREE_IF_COPY(geom, 0);
elog(ERROR,"Input geometry has unknown (-1) SRID");
elog(ERROR,"Input geometry has unknown (%d) SRID",SRID_UNKNOWN);
PG_RETURN_NULL();
}
@ -131,15 +131,15 @@ Datum transform_geom(PG_FUNCTION_ARGS)
result_srid = PG_GETARG_INT32(3);
if (result_srid == SRID_UNKNOWN)
{
elog(ERROR,"tranform: destination SRID = -1");
elog(ERROR,"tranform: destination SRID = %d",SRID_UNKNOWN);
PG_RETURN_NULL();
}
geom = (PG_LWGEOM *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
if (pglwgeom_get_srid(geom) == -1)
if (pglwgeom_get_srid(geom) == SRID_UNKNOWN)
{
pfree(geom);
elog(ERROR,"tranform: source SRID = -1");
elog(ERROR,"tranform: source SRID = %d",SRID_UNKNOWN);
PG_RETURN_NULL();
}

View file

@ -115,9 +115,9 @@ SELECT 'geojson_version_03', ST_AsGeoJson(-4, GeomFromEWKT('SRID=4326;POINT(1 1)
-- CRS
SELECT 'geojson_crs_01', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1 1)'), 0, 2);
SELECT 'geojson_crs_02', ST_AsGeoJson(GeomFromEWKT('SRID=-1;POINT(1 1)'), 0, 2);
SELECT 'geojson_crs_02', ST_AsGeoJson(GeomFromEWKT('SRID=0;POINT(1 1)'), 0, 2);
SELECT 'geojson_crs_03', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1 1)'), 0, 4);
SELECT 'geojson_crs_04', ST_AsGeoJson(GeomFromEWKT('SRID=-1;POINT(1 1)'), 0, 4);
SELECT 'geojson_crs_04', ST_AsGeoJson(GeomFromEWKT('SRID=0;POINT(1 1)'), 0, 4);
SELECT 'geojson_crs_05', ST_AsGeoJson(GeomFromEWKT('SRID=1;POINT(1 1)'), 0, 2);
SELECT 'geojson_crs_06', ST_AsGeoJson(GeomFromEWKT('SRID=1;POINT(1 1)'), 0, 4);
@ -128,21 +128,21 @@ SELECT 'geojson_bbox_03', ST_AsGeoJson(GeomFromEWKT('LINESTRING(1 1, 2 2, 3 3, 4
SELECT 'geojson_bbox_04', ST_AsGeoJson(GeomFromEWKT('LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 5);
-- CRS and Bbox
SELECT 'geojson_options_01', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 0);
SELECT 'geojson_options_01', ST_AsGeoJson(GeomFromEWKT('SRID=0;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 0);
SELECT 'geojson_options_02', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0);
SELECT 'geojson_options_03', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 1);
SELECT 'geojson_options_03', ST_AsGeoJson(GeomFromEWKT('SRID=0;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 1);
SELECT 'geojson_options_04', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 1);
SELECT 'geojson_options_05', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 2);
SELECT 'geojson_options_05', ST_AsGeoJson(GeomFromEWKT('SRID=0;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 2);
SELECT 'geojson_options_06', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 2);
SELECT 'geojson_options_07', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 3);
SELECT 'geojson_options_07', ST_AsGeoJson(GeomFromEWKT('SRID=0;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 3);
SELECT 'geojson_options_08', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 3);
SELECT 'geojson_options_09', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 4);
SELECT 'geojson_options_09', ST_AsGeoJson(GeomFromEWKT('SRID=0;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 4);
SELECT 'geojson_options_10', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 4);
SELECT 'geojson_options_11', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 5);
SELECT 'geojson_options_11', ST_AsGeoJson(GeomFromEWKT('SRID=0;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 5);
SELECT 'geojson_options_12', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 5);
SELECT 'geojson_options_13', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 6);
SELECT 'geojson_options_13', ST_AsGeoJson(GeomFromEWKT('SRID=0;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 6);
SELECT 'geojson_options_14', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 6);
SELECT 'geojson_options_15', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 7);
SELECT 'geojson_options_15', ST_AsGeoJson(GeomFromEWKT('SRID=0;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 7);
SELECT 'geojson_options_16', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 7);

View file

@ -23,7 +23,7 @@ gml_shortline_02|<Curve><segments><LineStringSegment><posList>1 2 3 4</posList><
gml_shortline_03|<MultiCurve><curveMember><LineString><posList>1 2 3 4</posList></LineString></curveMember><curveMember><LineString><posList>5 6 7 8</posList></LineString></curveMember></MultiCurve>
gml_shortline_04|<MultiCurve><curveMember><Curve><segments><LineStringSegment><posList>1 2 3 4</posList></LineStringSegment></segments></Curve></curveMember><curveMember><Curve><segments><LineStringSegment><posList>5 6 7 8</posList></LineStringSegment></segments></Curve></curveMember></MultiCurve>
ERROR: GetProj4StringSPI: Cannot find SRID (10) in spatial_ref_sys
ERROR: Input geometry has unknown (-1) SRID
ERROR: Input geometry has unknown (0) SRID
kml_empty_geom|
kml_precision_01|<Point><coordinates>1,1</coordinates></Point>
kml_precision_02|<Point><coordinates>1.1111111,1.1111111</coordinates></Point>

View file

@ -31,7 +31,7 @@ SELECT 5,ST_AsEWKT(ST_SnapToGrid(ST_transform(ST_GeomFromEWKT('SRID=100002;LINES
SELECT 6,round(ST_X(ST_transform(ST_transform(ST_GeomFromEWKT('SRID=100002;POINT(16 48)'),100001), 100002))::numeric,8),round(ST_Y(ST_transform(ST_transform(ST_GeomFromEWKT('SRID=100002;POINT(16 48)'),100001), 100002))::numeric,8);
--- test #7: Should yield an error since input SRID is unknown
SELECT ST_transform(ST_GeomFromEWKT('SRID=-1;POINT(0 0)'),100002);
SELECT ST_transform(ST_GeomFromEWKT('SRID=0;POINT(0 0)'),100002);
--- test #8: Transforming to same SRID
SELECT 8,ST_AsEWKT(ST_transform(ST_GeomFromEWKT('SRID=100002;POINT(0 0)'),100002));

View file

@ -5,5 +5,5 @@
4|SRID=100001;LINESTRING(574600 5316780,573140 5427940)
5|SRID=100001;LINESTRING(574600 5316780 0 0,573140 5427940 0 0)
6|16.00000000|48.00000000
ERROR: Input geometry has unknown (-1) SRID
ERROR: Input geometry has unknown (0) SRID
8|SRID=100002;POINT(0 0)

View file

@ -84,14 +84,14 @@ dimension03|1
dimension03|1
dimension04|1
dimension04|1
SRID01|-1
SRID01|-1
SRID02|-1
SRID02|-1
SRID03|-1
SRID03|-1
SRID04|-1
SRID04|-1
SRID01|0
SRID01|0
SRID02|0
SRID02|0
SRID03|0
SRID03|0
SRID04|0
SRID04|0
ERROR: Exception in LWGEOM2GEOS: curved geometry not supported.
ERROR: Exception in LWGEOM2GEOS: curved geometry not supported.
ERROR: Exception in LWGEOM2GEOS: curved geometry not supported.

View file

@ -54,10 +54,10 @@ dimension01|1
dimension02|1
dimension03|1
dimension04|1
SRID01|-1
SRID02|-1
SRID03|-1
SRID04|-1
SRID01|0
SRID02|0
SRID03|0
SRID04|0
ERROR: Exception in LWGEOM2GEOS: curved geometry not supported.
ERROR: Exception in LWGEOM2GEOS: curved geometry not supported.
ERROR: Exception in LWGEOM2GEOS: curved geometry not supported.

View file

@ -39,10 +39,10 @@ dimension01|2
dimension02|2
dimension03|2
dimension04|2
SRID01|-1
SRID02|-1
SRID03|-1
SRID04|-1
SRID01|0
SRID02|0
SRID03|0
SRID04|0
envelope01|POLYGON((-2 -1,-2 2,2 2,2 -1,-2 -1))
envelope02|POLYGON((-2 -1,-2 2,2 2,2 -1,-2 -1))
envelope03|POLYGON((-2 -1,-2 2,2 2,2 -1,-2 -1))