<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Doug,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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.  <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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.  <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Radu<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> postgis-users-bounces@postgis.refractions.net [mailto:postgis-users-bounces@postgis.refractions.net] <b>On Behalf Of </b>Doug_Newcomb@fws.gov<br><b>Sent:</b> Thursday, January 20, 2011 9:23 AM<br><b>To:</b> PostGIS Users Discussion<br><b>Subject:</b> Re: [postgis-users] Coordinates and SRID - bound overflow, ST_Equals<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><br><span style='font-size:10.0pt'>Radu,</span> <br><span style='font-size:10.0pt'>        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?  </span> <br><br><span style='font-size:10.0pt'>Doug</span> <br><br><br><span style='font-size:10.0pt;font-family:"Arial","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.</span> <br><br><o:p></o:p></p><table class=MsoNormalTable border=0 cellpadding=0 width="100%" style='width:100.0%'><tr><td width="40%" valign=top style='width:40.0%;padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal><b><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>"Ilie, Radu" <rilie@wsi.com></span></b><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'> </span><br><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>Sent by: postgis-users-bounces@postgis.refractions.net</span> <o:p></o:p></p><p><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>01/20/2011 08:33 AM</span> <o:p></o:p></p><table class=MsoNormalTable border=1 cellpadding=0><tr><td valign=top style='background:white;padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>Please respond to<br>PostGIS Users Discussion <postgis-users@postgis.refractions.net></span><o:p></o:p></p></td></tr></table></td><td width="59%" valign=top style='width:59.0%;padding:.75pt .75pt .75pt .75pt'><table class=MsoNormalTable border=0 cellpadding=0 width="100%" style='width:100.0%'><tr><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>To</span><o:p></o:p></p></td><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>"PostGIS Users Discussion" <postgis-users@postgis.refractions.net></span> <o:p></o:p></p></td></tr><tr><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>cc</span><o:p></o:p></p></td><td valign=top style='padding:.75pt .75pt .75pt .75pt'></td></tr><tr><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>Subject</span><o:p></o:p></p></td><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Arial","sans-serif"'>Re: [postgis-users] Coordinates and SRID - bound overflow, ST_Equals</span><o:p></o:p></p></td></tr></table><p class=MsoNormal><o:p> </o:p></p><table class=MsoNormalTable border=0 cellpadding=0><tr><td valign=top style='padding:.75pt .75pt .75pt .75pt'></td><td valign=top style='padding:.75pt .75pt .75pt .75pt'></td></tr></table></td></tr></table><p class=MsoNormal><br><br><br><span style='font-size:10.0pt'>Doug,</span> <br><span style='font-size:10.0pt'> </span> <br><span style='font-size:10.0pt'>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:</span> <br><span style='font-size:10.0pt'> </span> <br><span style='font-size:10.0pt'>ERROR:  Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type</span> <br><span style='font-size:10.0pt'> </span> <br><span style='font-size:10.0pt'>Our solution for now is to modify the PostGIS code and normalize points outside of (-180 -90,180 190) during the cast to geography.</span> <br><span style='font-size:10.0pt'> </span> <br><span style='font-size:10.0pt'>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.</span> <br><span style='font-size:10.0pt'> </span> <br><span style='font-size:10.0pt'>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.</span> <br><span style='font-size:10.0pt'> </span> <br><span style='font-size:10.0pt'>Radu Ilie</span> <br><span style='font-size:10.0pt'> </span> <br><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:10.0pt'> 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</span> <br>  <br><span style='font-size:10.0pt'><br>Balint</span> <span style='font-size:10.0pt'><br>Would using the geography data type be more suitable to what you are trying to accomplish?</span> <br><u><span style='color:blue'><br></span></u><a href="http://postgis.refractions.net/docs/ch04.html#PostGIS_GeographyVSGeometry"><span style='font-size:10.0pt'>http://postgis.refractions.net/docs/ch04.html#PostGIS_GeographyVSGeometry</span></a> <span style='font-size:10.0pt'><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.</span> <o:p></o:p></p><table class=MsoNormalTable border=0 cellpadding=0 width="100%" style='width:100.0%'><tr><td width="47%" valign=top style='width:47.0%;padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal><b><span style='font-size:7.5pt'>Balint Persics <persicsb@gmail.com></span></b><span style='font-size:7.5pt'> <br>Sent by: postgis-users-bounces@postgis.refractions.net</span> <o:p></o:p></p><p><span style='font-size:7.5pt'>01/20/2011 06:30 AM</span> <o:p></o:p></p><p><o:p> </o:p></p><table class=MsoNormalTable border=1 cellpadding=0><tr><td valign=top style='background:white;padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:7.5pt'>Please respond to<br>PostGIS Users Discussion <postgis-users@postgis.refractions.net></span><o:p></o:p></p></td></tr></table></td><td width="52%" valign=top style='width:52.0%;padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal><o:p> </o:p></p><table class=MsoNormalTable border=0 cellpadding=0 width="100%" style='width:100.0%'><tr><td width="9%" valign=top style='width:9.0%;padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:7.5pt'>To</span><o:p></o:p></p></td><td width="90%" valign=top style='width:90.0%;padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal><span style='font-size:7.5pt'>postgis-users@postgis.refractions.net</span> <o:p></o:p></p></td></tr><tr><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:7.5pt'>cc</span><o:p></o:p></p></td><td valign=top style='padding:.75pt .75pt .75pt .75pt'></td></tr><tr><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:7.5pt'>Subject</span><o:p></o:p></p></td><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal><span style='font-size:7.5pt'>[postgis-users] Coordinates and SRID - bound overflow, ST_Equals</span><o:p></o:p></p></td></tr></table><p class=MsoNormal><br>  <o:p></o:p></p><p><o:p> </o:p></p><table class=MsoNormalTable border=0 cellpadding=0><tr><td valign=top style='padding:.75pt .75pt .75pt .75pt'></td><td valign=top style='padding:.75pt .75pt .75pt .75pt'></td></tr></table></td></tr></table><p><br><br><br><span style='font-size:10.0pt;font-family:"Courier New"'><br>Hi,</span><span style='font-size:10.0pt'><br></span><span style='font-size:10.0pt;font-family:"Courier New"'><br>I have a very interesting problem, but I think some of you may have a<br>solution for that.</span><span style='font-size:10.0pt'><br></span><span style='font-size:10.0pt;font-family:"Courier New"'><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.</span><span style='font-size:10.0pt'><br></span><span style='font-size:10.0pt;font-family:"Courier New"'><br>Thanks,<br>Balint</span><span style='font-size:10.0pt'><br></span><span style='font-size:10.0pt;font-family:"Courier New"'><br>-- <br>Persics Balint<br>_______________________________________________<br>postgis-users mailing list<br>postgis-users@postgis.refractions.net</span><u><span style='color:blue'><br></span></u><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users"><span style='font-size:10.0pt;font-family:"Courier New"'>http://postgis.refractions.net/mailman/listinfo/postgis-users</span></a><tt><span style='font-size:10.0pt'>_______________________________________________</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt>postgis-users mailing list</tt><br><tt>postgis-users@postgis.refractions.net</tt><br></span><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users"><tt><span style='font-size:10.0pt'>http://postgis.refractions.net/mailman/listinfo/postgis-users</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br></span></a><o:p></o:p></p></div></body></html>