From: Regina Obe Date: Fri, 3 May 2013 05:54:48 +0000 (+0000) Subject: #1292 commit patch ST_SnapToGrid returns a value of of range X-Git-Tag: 2.1.0beta2~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=660104c1ce628a88acbcf43838f765b887a504aa;p=postgis #1292 commit patch ST_SnapToGrid returns a value of of range git-svn-id: http://svn.osgeo.org/postgis/trunk@11345 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index f77deab4e..bd4441d54 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -83,7 +83,8 @@ 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_nudge_geodetic(lwgeom) && lwgeom_force_geodetic(lwgeom) == LW_TRUE ) + lwgeom_nudge_geodetic(lwgeom); + if ( lwgeom_force_geodetic(lwgeom) == LW_TRUE ) { ereport(NOTICE, ( errmsg_internal("Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY" )) @@ -584,7 +585,8 @@ Datum geography_from_geometry(PG_FUNCTION_ARGS) srid_is_latlong(fcinfo, lwgeom->srid); /* Force the geometry to have valid geodetic coordinate range. */ - if ( ! lwgeom_nudge_geodetic(lwgeom) && lwgeom_force_geodetic(lwgeom) == LW_TRUE ) + lwgeom_nudge_geodetic(lwgeom); + if ( 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 cbe197eed..ed7d4a37a 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -479,6 +479,10 @@ 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); +-- #1292.1 +SELECT '#1292.1', ST_AsText(ST_GeomFromText('POINT(180.00000000001 95)')::geography), + ST_AsText(ST_GeomFromText('POINT(185 90.00000000001)')::geography); + -- #1320 SELECT '<#1320>'; CREATE TABLE A ( geom geometry(MultiPolygon, 4326), diff --git a/regress/tickets_expected b/regress/tickets_expected index 91bda2781..d2579fcd2 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -151,6 +151,9 @@ 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))) +NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY +NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY +#1292.1|POINT(180 85)|POINT(-175 90) <#1320> #1320.geog.1|MULTIPOLYGON|4326 #1320.geom.1|MULTIPOLYGON|4326