[postgis-users] st_extent crossing international date line
Brent Wood
pcreso at pcreso.com
Thu May 22 14:21:25 PDT 2014
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 at gmail.com>
To: postgis-users at 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 at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140522/d18cdda5/attachment.html>
More information about the postgis-users
mailing list