[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] st_extent crossing international date line
From:       Brent Wood <pcreso () pcreso ! com>
Date:       2014-05-22 21:21:25
Message-ID: 1400793685.28418.YahooMailNeo () web121204 ! mail ! ne1 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]




Hi Christian,

Still use ST_Shift_Longitude()... it works best with points - polygons & linestrings \
can have topological issues that it doesn't address.

SELECT st_extent(
test(# ST_GeomFromText('MULTIPOINT(162.06 56.144, -140.808 66.07, -153.301 \
57.36)',4326));  st_extent             
-----------------------------------
 BOX(-153.301 56.144,162.06 66.07)
(1 row)

test=# SELECT st_extent(ST_Shift_Longitude(
ST_GeomFromText('MULTIPOINT(162.06 56.144, -140.808 66.07, -153.301 57.36)',4326)));
            st_extent             
----------------------------------
 BOX(162.06 56.144,219.192 66.07)
(1 row)



It depends if you want a 0-360 or +-180 extent... 


A better solution would perhaps be if ST_Extent() worked with the geography datatype \
- but the point sequence would need to implicitly determine the polygon extent across \
180.

To be robust, you could maybe calculate the 0-360 and +-180 extents, & take the one \
with the smaller area?


HTH,


Brent Wood



________________________________
 From: Christian Gendreau <christiangendreau@gmail.com>
To: postgis-users@lists.osgeo.org 
Sent: Friday, May 23, 2014 3:05 AM
Subject: [postgis-users] st_extent crossing international date line
 


Hi there,

I was wondering how can we perform an extent over the international date line?

ST_Shift_Longitude seems perfect to compare 2 polygons over the IDL but what if I \
have 3 points (let say 2 in Alaska and 1 in Russia) and I want the get the extent?

e.g. SELECT st_extent(ST_GeomFromText('MULTIPOINT(162.06 56.144, -140.808 66.07, \
-153.301 57.36)',4326));

Returns: BOX(-153.301 56.144,162.06 66.07), the longitude -140 was no included due to \
IDL.

Regards,

Christian Gendreau
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


[Attachment #5 (text/html)]

<html><body><div style="color:#000; background-color:#fff; font-family:times new \
roman, new york, times, serif;font-size:10pt"><div><span><br></span></div><div>Hi \
Christian,</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; \
font-family: times new roman,new york,times,serif; background-color: transparent; \
font-style: normal;">Still use ST_Shift_Longitude()... it works best with points - \
polygons &amp; linestrings can have topological issues that it doesn't \
address.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: \
times new roman,new york,times,serif; background-color: transparent; font-style: \
normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; \
font-family: times new roman,new york,times,serif; background-color: transparent; \
font-style: normal;"><span style="font-family: Courier \
New,courier,monaco,monospace,sans-serif;">SELECT st_extent(<br>test(# \
ST_GeomFromText('MULTIPOINT(162.06  56.144, -140.808 66.07, -153.301 \
57.36)',4326));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
st_extent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
<br>-----------------------------------<br>&nbsp;BOX(-153.301 56.144,162.06 \
66.07)<br>(1 row)<br><br>test=# SELECT \
st_extent(ST_Shift_Longitude(<br>ST_GeomFromText('MULTIPOINT(162.06 56.144, -140.808 \
66.07, -153.301 57.36)',4326)));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
st_extent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
<br>----------------------------------<br>&nbsp;BOX(162.06 56.144,219.192 \
66.07)<br>(1 row)</span><br><br></div><div style="color: rgb(0, 0, 0); font-size: \
13.3333px; font-family: times new roman,new york,times,serif; background-color: \
transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); \
font-size: 13.3333px; font-family: times new roman,new  york,times,serif; \
background-color: transparent; font-style: normal;">It depends if you want a 0-360 or \
+-180 extent... <br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; \
font-family: times new roman,new york,times,serif; background-color: transparent; \
font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; \
font-family: times new roman,new york,times,serif; background-color: transparent; \
font-style: normal;">A better solution would perhaps be if ST_Extent() worked with \
the geography datatype - but the point sequence would need to implicitly determine \
the polygon extent across 180.</div><div style="color: rgb(0, 0, 0); font-size: \
13.3333px; font-family: times new roman,new york,times,serif; background-color: \
transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); \
font-size: 13.3333px; font-family: times new roman,new york,times,serif; \
background-color: transparent; font-style: normal;">To  be robust, you could maybe \
calculate the 0-360 and +-180 extents, &amp; take the one with the smaller \
area?<br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: \
times new roman,new york,times,serif; background-color: transparent; font-style: \
normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; \
font-family: times new roman,new york,times,serif; background-color: transparent; \
font-style: normal;">HTH,<br></div><div style="color: rgb(0, 0, 0); font-size: \
13.3333px; font-family: times new roman,new york,times,serif; background-color: \
transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); \
font-size: 13.3333px; font-family: times new roman,new york,times,serif; \
background-color: transparent; font-style: normal;">Brent Wood<br></div><div \
style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: times new roman,new \
york,times,serif; background-color: transparent; font-style:  normal;"><br></div>  \
<div style="font-family: times new roman, new york, times, serif; font-size: 10pt;"> \
<div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> \
<div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span \
style="font-weight:bold;">From:</span></b> Christian Gendreau \
&lt;christiangendreau@gmail.com&gt;<br> <b><span style="font-weight: \
bold;">To:</span></b> postgis-users@lists.osgeo.org <br> <b><span style="font-weight: \
bold;">Sent:</span></b> Friday, May 23, 2014 3:05 AM<br> <b><span style="font-weight: \
bold;">Subject:</span></b> [postgis-users] st_extent crossing international date \
line<br> </font> </div> <div class="y_msg_container"><br><div id="yiv1057372925"><div \
dir="ltr"><span style="font-family:arial, sans-serif;font-size:13px;">Hi \
there,</span><br style="font-family:arial, sans-serif;font-size:13px;"><br \
style="font-family:arial, sans-serif;font-size:13px;"><span style="font-family:arial, \
sans-serif;font-size:13px;">I was wondering how can we perform an extent over the \
international date line?</span><br style="font-family:arial, \
sans-serif;font-size:13px;"> <br style="font-family:arial, \
sans-serif;font-size:13px;"><font face="arial, \
sans-serif">ST_Shift_Longitude&nbsp;seems perfect to compare 2 polygons over the IDL \
but what if I have 3 points (let say 2 in Alaska and 1 in Russia) and I want the get \
the extent?</font><div> <font face="arial, sans-serif"><br></font></div><div><font \
face="arial, sans-serif">e.g.&nbsp;</font><span style="font-family:arial, \
sans-serif;">SELECT st_extent(</span><font face="arial, \
sans-serif"><div>ST_GeomFromText('MULTIPOINT(162.06 56.144, -140.808 66.07, -153.301 \
57.36)',4326));</div> <div><br></div><div>Returns: BOX(-153.301 56.144,162.06 66.07), \
the longitude -140 was no included due to IDL.</div></font><div><font face="arial, \
sans-serif"><br></font></div><div><font face="arial, sans-serif">Regards,<br \
clear="all"> </font><div><br></div>Christian \
Gendreau</div></div></div></div><br>_______________________________________________<br>postgis-users \
mailing list<br><a ymailto="mailto:postgis-users@lists.osgeo.org" \
href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br><a \
href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" \
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br><br></div> \
</div> </div>  </div></body></html>



_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic