<br><font size=2 face="Times New Roman">>Doug,</font>
<br><font size=2 face="Times New Roman"> </font>
<br><font size=2 face="Times New Roman">>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.  </font>
<br><font size=2 face="Times New Roman"> </font>
<br><font size=2 face="Times New Roman">>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.
 </font>
<br><font size=2 face="Times New Roman"> </font>
<br><font size=2 face="Times New Roman">>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.</font>
<br><font size=2 face="Times New Roman"> </font>
<br><font size=2 face="Times New Roman">>Radu</font>
<br>
<br><font size=2 face="Times New Roman">Radu,</font>
<br><font size=2 face="Times New Roman">         
I'm afraid writing that casting function is beyond my current capabilities,
sorry.</font>
<br>
<br><font size=2 face="Times New Roman">Doug</font>
<br>
<br>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">Doug Newcomb        
    <br>
USFWS<br>
Raleigh, NC<br>
919-856-4520 ext. 14 doug_newcomb@fws.gov<br>
---------------------------------------------------------------------------------------------------------<br>
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.</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>"Ilie, Radu"
<rilie@wsi.com></b> </font>
<br><font size=1 face="sans-serif">Sent by: postgis-users-bounces@postgis.refractions.net</font>
<p><font size=1 face="sans-serif">01/20/2011 10:02 AM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
PostGIS Users Discussion <postgis-users@postgis.refractions.net></font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">"PostGIS Users Discussion"
<postgis-users@postgis.refractions.net></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [postgis-users] Coordinates and
SRID - bound overflow, ST_Equals</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br>
<br><font size=2 face="Times New Roman"> </font>
<br><font size=2 face="Times New Roman"><b>From:</b> postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <b>On Behalf Of
</b>Doug_Newcomb@fws.gov<b><br>
Sent:</b> Thursday, January 20, 2011 9:23 AM<b><br>
To:</b> PostGIS Users Discussion<b><br>
Subject:</b> Re: [postgis-users] Coordinates and SRID - bound overflow,
ST_Equals</font>
<br><font size=3 face="Times New Roman"> </font>
<br><font size=2 face="Times New Roman"><br>
Radu,</font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
        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?  </font><font size=3 face="Times New Roman">
<br>
</font><font size=2 face="Times New Roman"><br>
Doug</font><font size=3 face="Times New Roman"> <br>
<br>
</font><font size=2 face="Times New Roman"><br>
Doug Newcomb             <br>
USFWS<br>
Raleigh, NC<br>
919-856-4520 ext. 14 doug_newcomb@fws.gov<br>
---------------------------------------------------------------------------------------------------------<br>
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.</font><font size=3 face="Times New Roman">
<br>
</font>
<p>
<table width=100%>
<tr valign=top>
<td width=46%><font size=1 face="Times New Roman"><b>"Ilie, Radu"
<rilie@wsi.com></b> <br>
Sent by: postgis-users-bounces@postgis.refractions.net</font><font size=3 face="Times New Roman">
</font>
<p><font size=1 face="Times New Roman">01/20/2011 08:33 AM</font><font size=3 face="Times New Roman">
</font>
<p>
<br>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="Times New Roman">Please respond to<br>
PostGIS Users Discussion <postgis-users@postgis.refractions.net></font></div></table>
<br>
<td width=53%>
<br>
<table width=100%>
<tr valign=top>
<td width=9%>
<div align=right><font size=1 face="Times New Roman">To</font></div>
<td width=90%><font size=1 face="Times New Roman">"PostGIS Users Discussion"
<postgis-users@postgis.refractions.net></font><font size=3 face="Times New Roman">
</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="Times New Roman">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="Times New Roman">Subject</font></div>
<td><font size=1 face="Times New Roman">Re: [postgis-users] Coordinates
and SRID - bound overflow, ST_Equals</font></table>
<br><font size=3 face="Times New Roman"> </font>
<p>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br><font size=3 face="Times New Roman"><br>
<br>
</font><font size=2 face="Times New Roman"><br>
Doug,</font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
 </font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
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:</font><font size=3 face="Times New Roman">
</font><font size=2 face="Times New Roman"><br>
 </font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
ERROR:  Coordinate values are out of range [-180 -90, 180 90] for
GEOGRAPHY type</font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
 </font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
Our solution for now is to modify the PostGIS code and normalize points
outside of (-180 -90,180 190) during the cast to geography.</font><font size=3 face="Times New Roman">
</font><font size=2 face="Times New Roman"><br>
 </font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
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.</font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
 </font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
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.</font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
 </font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
Radu Ilie</font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
 </font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><b><br>
From:</b> postgis-users-bounces@postgis.refractions.net [mailto:postgis-users-bounces@postgis.refractions.net]
<b>On Behalf Of </b>Doug_Newcomb@fws.gov<b><br>
Sent:</b> Thursday, January 20, 2011 8:02 AM<b><br>
To:</b> PostGIS Users Discussion<b><br>
Subject:</b> Re: [postgis-users] Coordinates and SRID - bound overflow,
ST_Equals</font><font size=3 face="Times New Roman"> <br>
  </font><font size=2 face="Times New Roman"><br>
<br>
Balint</font><font size=3 face="Times New Roman"> </font><font size=2 face="Times New Roman"><br>
Would using the geography data type be more suitable to what you are trying
to accomplish?</font><font size=3 face="Times New Roman"> </font><font size=3 color=blue face="Times New Roman"><u><br>
<br>
</u></font><a href=http://postgis.refractions.net/docs/ch04.html#PostGIS_GeographyVSGeometry><font size=2 color=blue face="Times New Roman"><u>http://postgis.refractions.net/docs/ch04.html#PostGIS_GeographyVSGeometry</u></font></a><font size=3 face="Times New Roman">
</font><font size=2 face="Times New Roman"><br>
Doug Newcomb             <br>
USFWS<br>
Raleigh, NC<br>
919-856-4520 ext. 14 doug_newcomb@fws.gov<br>
---------------------------------------------------------------------------------------------------------<br>
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.</font><font size=3 face="Times New Roman">
</font>
<p>
<table width=100%>
<tr valign=top>
<td width=47%><font size=1 face="Times New Roman"><b>Balint Persics <persicsb@gmail.com></b>
<br>
Sent by: postgis-users-bounces@postgis.refractions.net</font><font size=3 face="Times New Roman">
</font>
<p><font size=1 face="Times New Roman">01/20/2011 06:30 AM</font><font size=3 face="Times New Roman">
</font>
<p><font size=3 face="Times New Roman"> </font>
<p>
<br>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="Times New Roman">Please respond to<br>
PostGIS Users Discussion <postgis-users@postgis.refractions.net></font></div></table>
<br>
<td width=52%><font size=3 face="Times New Roman"> </font>
<p>
<br>
<table width=100%>
<tr valign=top>
<td width=9%>
<div align=right><font size=1 face="Times New Roman">To</font></div>
<td width=90%><font size=1 face="Times New Roman">postgis-users@postgis.refractions.net</font><font size=3 face="Times New Roman">
</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="Times New Roman">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="Times New Roman">Subject</font></div>
<td><font size=1 face="Times New Roman">[postgis-users] Coordinates and
SRID - bound overflow, ST_Equals</font></table>
<br><font size=3 face="Times New Roman"><br>
  </font>
<p><font size=3 face="Times New Roman"> </font>
<p>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<p><font size=3 face="Times New Roman"><br>
<br>
</font><font size=2 face="Times New Roman"><br>
<br>
Hi,<br>
<br>
I have a very interesting problem, but I think some of you may have a<br>
solution for that.<br>
<br>
When I try to model Russia with EPSG:4326 coordinates, I "run out
of<br>
the bounds", e.g.  Russia's extent is so wide, it overlaps the<br>
-180/+180 coordinate range of EPSG:4326, so the most<br>
eastern part is in the western Hemisphere. When inserting points to<br>
the geometry column, PostGIS allows me to insert both (186,45) and<br>
(-174,45) (the former is out of the bounds of the reference, the<br>
latter is okay). When I query the database whether these two points<br>
are equal with ST_Equals, I get a false result , but in reality, they<br>
are the same. I think there should be a version of ST_Equals which<br>
compares the geometries taking into account their SRID.<br>
<br>
Thanks,<br>
Balint<br>
<br>
-- <br>
Persics Balint<br>
_______________________________________________<br>
postgis-users mailing list<br>
postgis-users@postgis.refractions.net</font><font size=3 color=blue face="Times New Roman"><u><br>
</u></font><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users"><font size=2 color=blue face="Times New Roman"><u>http://postgis.refractions.net/mailman/listinfo/postgis-users</u></font></a><font size=2 face="Courier New">_______________________________________________<br>
postgis-users mailing list<br>
postgis-users@postgis.refractions.net</font><font size=3 color=blue face="Times New Roman"><u><br>
</u></font><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users"><font size=2 color=blue face="Courier New"><u>http://postgis.refractions.net/mailman/listinfo/postgis-users</u></font></a><tt><font size=2>_______________________________________________<br>
postgis-users mailing list<br>
postgis-users@postgis.refractions.net<br>
</font></tt><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users"><tt><font size=2>http://postgis.refractions.net/mailman/listinfo/postgis-users<br>
</font></tt></a>
<p>