[postgis-users] Problem with convex hulls that cross the dateline

Sarah Berke skberke at uchicago.edu
Tue Sep 6 10:13:19 PDT 2011


I'm having trouble making convex hulls that cross the international
dateline. Imagine 4 points making a square with the international dateline
running down the middle--I would like the convex hull to be that square, but
instead I get a giant rectangle that goes across the entire planet. I've
done some reading, and it sounds like GEOS generally has a hard time dealing
with the dateline--is that accurate? Does anyone know of a way to get around
this? I was thinking that it might work if I use an SRID that is just like
4326 but with a central meridian of 180, does that sound like a good plan?
I'm pretty new to postGIS and I'm not sure how to either find such an SRID
or how to define it--I've been trying to find an explanation of SRID syntax
and so far coming up empty. If anyone has advice for solving this problem,
or for places where I can learn more about defining custom SRIDs, I'd be
really grateful!

Here's an example--if you make this table and then look at it in QGIS (or
whatever) along with a world map, you'll see a big rectangle spanning the
entire map. On a map with central meridian of zero, I'd want to see half the
polygon on the left side of the map and the other half on the right side.

SELECT ST_ConvexHull(
    ST_Collect(ST_GeomFromText('MULTIPOINT(175 5, 175 30, -175 5, -175 30)')
))::geography(Polygon, 4326) ;

Thanks very much,

Sarah K Berke
Postdoctoral Scholar
Department of the Geophysical Sciences
University of Chicago
5734 S. Ellis Ave
Chicago, IL 60637
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110906/3ec6c9a1/attachment.html>

More information about the postgis-users mailing list