From: Paul Ramsey Date: Fri, 22 Feb 2013 18:26:55 +0000 (+0000) Subject: #1292, go back to nudging geodetic coordinates (realityexists) X-Git-Tag: 2.1.0beta2~196 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a69e0edb02c52225ca086f78f50a871c0b40b9f6;p=postgis #1292, go back to nudging geodetic coordinates (realityexists) git-svn-id: http://svn.osgeo.org/postgis/trunk@11109 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index 95e6b45c3..ab73ae55e 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -86,7 +86,7 @@ GSERIALIZED* gserialized_geography_from_lwgeom(LWGEOM *lwgeom, int32 geog_typmod geography_valid_type(lwgeom->type); /* Force the geometry to have valid geodetic coordinate range. */ - if ( lwgeom_force_geodetic(lwgeom) == LW_TRUE ) + if ( ! lwgeom_nudge_geodetic(lwgeom) && lwgeom_force_geodetic(lwgeom) == LW_TRUE ) { ereport(NOTICE, ( errmsg_internal("Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY" )) @@ -587,7 +587,7 @@ Datum geography_from_geometry(PG_FUNCTION_ARGS) srid_is_latlong(fcinfo, lwgeom->srid); /* Force the geometry to have valid geodetic coordinate range. */ - if ( lwgeom_force_geodetic(lwgeom) == LW_TRUE ) + if ( ! lwgeom_nudge_geodetic(lwgeom) && lwgeom_force_geodetic(lwgeom) == LW_TRUE ) { ereport(NOTICE, ( errmsg_internal("Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY" )) diff --git a/regress/tickets.sql b/regress/tickets.sql index 6bb9ba979..5f93b1e6f 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -474,6 +474,11 @@ select '#877.5', round(st_xmin(e.e)::numeric, 5), round(st_xmax(e.e)::numeric, 5 round(st_ymin(e.e)::numeric, 5), round(st_ymax(e.e)::numeric, 5) from e; drop table t; +-- #1292 +SELECT '#1292', ST_AsText(ST_SnapToGrid(ST_GeomFromText( + 'GEOMETRYCOLLECTION(POINT(180 90),POLYGON((140 50,150 50,180 50,140 50),(140 60,150 60,180 60,140 60)))' + , 4326), 0.00001)::geography); + -- #1320 SELECT '<#1320>'; CREATE TABLE A ( geom geometry(MultiPolygon, 4326), diff --git a/regress/tickets_expected b/regress/tickets_expected index ce3667b42..446f44130 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -149,6 +149,7 @@ ERROR: stats for "t.g" do not exist ERROR: stats for "t.g" do not exist #877.4|-10.15000|20.15000|-50.40000|30.40000 #877.5|-10.15000|20.15000|-50.40000|30.40000 +#1292|GEOMETRYCOLLECTION(POINT(180 90),POLYGON((140 50,150 50,180 50,140 50),(140 60,150 60,180 60,140 60))) <#1320> #1320.geog.1|MULTIPOLYGON|4326 #1320.geom.1|MULTIPOLYGON|4326 @@ -191,7 +192,6 @@ ERROR: MultiSurface cannot contain MultiPoint element at character 8 ERROR: AddToPROJ4SRSCache: could not parse proj4 string '' #1038| #1042|2 -NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY #1170|90 #1264|t #1398a|POINT(-119.093153 45.632669)