[postgis-users] Coordinates and SRID - bound overflow, ST_Equals

Doug_Newcomb at fws.gov Doug_Newcomb at fws.gov
Thu Jan 20 09:57:38 PST 2011


>Doug,
 
>There are cases where we need to use a difference branch of longitude 
values, e.g. 0 to 360, rather than -180 to 180.  For example, if one has a 
polygon that spans the international dateline, >and one uses longitude 
from -180 to 180, some vertices of the polygon will have longitudes near 
180, while others will have longitudes near -180.  When drawn as a 
Cartesian GEOMETRY, >this will contain lines that span the entire earth. 
 
>To work around the limitation of Cartesian geometries for polygons and 
lines, we sometimes use longitudes from 0 to 360 and other times use 
longitudes from -180 to 180, depending on where >the geometries are 
located.  Because our geometries span the globe, we cannot use either of 
these branches of longitude exclusively. 
 
>We want to convert these geometries to geographies to avoid the Cartesian 
limitation, and it would be nice if the transformation could be automatic 
through the casting function.
 
>Radu

Radu,
          I'm afraid writing that casting function is beyond my current 
capabilities, sorry.

Doug





Doug Newcomb 
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb at fws.gov
---------------------------------------------------------------------------------------------------------
The opinions I express are my own and are not representative of the 
official policy of the U.S.Fish and Wildlife Service or Dept. of the 
Interior.   Life is too short for undocumented, proprietary data formats.



"Ilie, Radu" <rilie at wsi.com> 
Sent by: postgis-users-bounces at postgis.refractions.net
01/20/2011 10:02 AM
Please respond to
PostGIS Users Discussion <postgis-users at postgis.refractions.net>


To
"PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
cc

Subject
Re: [postgis-users] Coordinates and SRID - bound overflow, ST_Equals







 
From: postgis-users-bounces at postgis.refractions.net 
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of 
Doug_Newcomb at fws.gov
Sent: Thursday, January 20, 2011 9:23 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Coordinates and SRID - bound overflow, 
ST_Equals
 

Radu, 
        I am somewhat confused.  From my somewhat limited understanding of 
EPSG:4326 it's limited to values between 180, -180 for longitude and 
90,-90 for latitude.  If your source geometry is epsg:4326, there should 
not be values outside of those limits.  Are you wrapping around those 
limits in your geometry column to accomodate lines/polygons  that cross 
those boundaries ? ( Stretching my brain a bit here)  Can you give 
examples of coordinates that you have that are exceed these limits?   

Doug 


Doug Newcomb 
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb at fws.gov
---------------------------------------------------------------------------------------------------------
The opinions I express are my own and are not representative of the 
official policy of the U.S.Fish and Wildlife Service or Dept. of the 
Interior.   Life is too short for undocumented, proprietary data formats. 


"Ilie, Radu" <rilie at wsi.com> 
Sent by: postgis-users-bounces at postgis.refractions.net 
01/20/2011 08:33 AM 


Please respond to
PostGIS Users Discussion <postgis-users at postgis.refractions.net>



To
"PostGIS Users Discussion" <postgis-users at postgis.refractions.net> 
cc

Subject
Re: [postgis-users] Coordinates and SRID - bound overflow, ST_Equals
 








Doug, 
  
We do have the same problem. We are in a situation where a central server 
has a column of type geometry (SRID 4326) and it has points with 
latitude/longitude outside of (-180 -90,180 90). We need to retrieve the 
values from this column and insert them into a local server where the 
column is of type geography. It doesn’t work, we get errors like this: 
  
ERROR:  Coordinate values are out of range [-180 -90, 180 90] for 
GEOGRAPHY type 
  
Our solution for now is to modify the PostGIS code and normalize points 
outside of (-180 -90,180 190) during the cast to geography. 
  
The solution is cumbersome, because it requires us to build PostGIS from 
source under Windows (the local server is Windows 7). And that is a 
science project in itself. 
  
For reasons outside our control we cannot change the type of the column on 
the central server, nor can we move the local server to Linux. Is there 
any way to use the existing functions in PostGIS to normalize points 
outside the allowed range for geography? We need something that can be 
used during an implicit cast. 
  
Radu Ilie 
  
From: postgis-users-bounces at postgis.refractions.net 
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of 
Doug_Newcomb at fws.gov
Sent: Thursday, January 20, 2011 8:02 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Coordinates and SRID - bound overflow, 
ST_Equals 
  

Balint 
Would using the geography data type be more suitable to what you are 
trying to accomplish? 

http://postgis.refractions.net/docs/ch04.html#PostGIS_GeographyVSGeometry 
Doug Newcomb 
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb at fws.gov
---------------------------------------------------------------------------------------------------------
The opinions I express are my own and are not representative of the 
official policy of the U.S.Fish and Wildlife Service or Dept. of the 
Interior.   Life is too short for undocumented, proprietary data formats. 

Balint Persics <persicsb at gmail.com> 
Sent by: postgis-users-bounces at postgis.refractions.net 
01/20/2011 06:30 AM 
 


Please respond to
PostGIS Users Discussion <postgis-users at postgis.refractions.net>

 


To
postgis-users at postgis.refractions.net 
cc

Subject
[postgis-users] Coordinates and SRID - bound overflow, ST_Equals

 
 









Hi,

I have a very interesting problem, but I think some of you may have a
solution for that.

When I try to model Russia with EPSG:4326 coordinates, I "run out of
the bounds", e.g.  Russia's extent is so wide, it overlaps the
-180/+180 coordinate range of EPSG:4326, so the most
eastern part is in the western Hemisphere. When inserting points to
the geometry column, PostGIS allows me to insert both (186,45) and
(-174,45) (the former is out of the bounds of the reference, the
latter is okay). When I query the database whether these two points
are equal with ST_Equals, I get a false result , but in reality, they
are the same. I think there should be a version of ST_Equals which
compares the geometries taking into account their SRID.

Thanks,
Balint

-- 
Persics Balint
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110120/46aa3350/attachment.html>


More information about the postgis-users mailing list