<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16434"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=557585500-09092011><FONT color=#0000ff
size=2 face=Arial>I don't think it's that hard. The function hack is all
in SQL.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557585500-09092011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=557585500-09092011><FONT color=#0000ff
size=2 face=Arial>Just look at the st_buffer geography sql function and create a
similar ST_ConvexHull sql function replace ST_Buffer with ST_ConvexHull and get
rid of the distance arg</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557585500-09092011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=557585500-09092011><FONT color=#0000ff
size=2 face=Arial>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557585500-09092011><FONT color=#0000ff
size=2 face=Arial>Regina</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Sarah Berke<BR><B>Sent:</B> Thursday, September 08, 2011 3:22
PM<BR><B>To:</B> postgis-users@postgis.refractions.net<BR><B>Subject:</B> Re:
[postgis-users] Problem with convex hulls that cross
thedateline<BR></FONT><BR></DIV>
<DIV></DIV>Thanks very much, Regina, Paul, and Ben for the responses. I don't
think my hacking skills are quite up to following Paul's suggestion, but I can
try to find an equal area projection for the Pacific Ocean. It seems like that
would work. I also rather like the idea of translating the points--if I did
that, would it then be easy to just translate the entire hull back into
position?<BR><BR>Thanks,<BR>Sarah<BR
clear=all>_________________________________<BR>Sarah K Berke<BR>Postdoctoral
Scholar<BR>Department of the Geophysical Sciences<BR>University of
Chicago<BR>5734 S. Ellis Ave<BR>Chicago, IL 60637<BR><BR><BR>
<DIV class=gmail_quote><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><BR>------------------------------<BR><BR>Message:
2<BR>Date: Wed, 7 Sep 2011 01:18:51 -0400<BR>From: "Paragon Corporation"
<<A href="mailto:lr@pcorp.us">lr@pcorp.us</A>><BR>Subject: Re:
[postgis-users] Problem with convex hulls that cross the<BR>
dateline<BR>To: "'PostGIS Users Discussion'"<BR>
<<A
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A>><BR>Message-ID:
<F8675FD4BB254CD09D2359CF11685DEA@D><BR>Content-Type: text/plain;
charset="us-ascii"<BR><BR> Sarah,<BR> > I'm having
trouble making convex hulls that cross the international<BR>dateline.
Imagine 4 points making a square with the international dateline<BR>running
down the middle--I would like the convex hull to be that square,
but<BR>instead I get a giant rectangle that goes across the entire planet.
I've<BR>done some reading, and it sounds like GEOS generally has a hard time
dealing<BR>with the dateline--is that accurate?<BR>Yes GEOS only deals
with planar coordinates. Geography is the only<BR>geodetic aware type
and there is no ConvexHull function for it.<BR><BR> > Does
anyone know of a way to get around this? I was thinking that it<BR>might
work if I use an SRID that is just like 4326 but with a central<BR>meridian
of 180, does that sound like a good plan?<BR>No. You should use a
planar projection of some sort. 4326 squashed on a<BR>map is no good.
Paul Ramsey might have some thoughts on the matter.<BR><BR>>
I'm pretty new to postGIS and I'm not sure how to either find such
an<BR>SRID or how to define it--I've been trying to find an explanation of
SRID<BR>syntax and so far coming up empty. If anyone has advice for solving
this<BR>problem, or for places where I can learn more about defining custom
SRIDs,<BR>I'd be really grateful!<BR><BR>You might want to check out <A
href="http://spatialreference.org"
target=_blank>http://spatialreference.org</A><BR><BR> > Here's
an example--if you make this table and then look at it in QGIS<BR>(or
whatever) along with a world map, you'll see a big rectangle spanning<BR>the
entire map. On a map with<BR>> central meridian of zero, I'd want
to see half the polygon on the left<BR>side of the map and the other half on
the right side.<BR><BR> > CREATE TABLE example
AS<BR> > SELECT ST_ConvexHull(<BR> >
ST_Collect(ST_GeomFromText('MULTIPOINT(175 5, 175 30, -175 5, -175<BR>30)')
))::geography(Polygon, 4326) ;<BR><BR>My guess is you'll have to cut your
area into pieces. Still then its not<BR>that pretty when you try to
rejoin.<BR><BR>Sorry couldn't be more help,<BR>Regina<BR><A
href="http://www.postgis.us"
target=_blank>http://www.postgis.us</A><BR><BR>-------------- next part
--------------<BR>An HTML attachment was scrubbed...<BR>URL: <<A
href="http://postgis.refractions.net/pipermail/postgis-users/attachments/20110907/dca69b0a/attachment-0001.html"
target=_blank>http://postgis.refractions.net/pipermail/postgis-users/attachments/20110907/dca69b0a/attachment-0001.html</A>><BR><BR>------------------------------<BR><BR>Message:
3<BR>Date: Tue, 6 Sep 2011 22:21:48 -0700<BR>From: Paul Ramsey <<A
href="mailto:pramsey@opengeo.org">pramsey@opengeo.org</A>><BR>Subject:
Re: [postgis-users] Problem with convex hulls that cross the<BR>
dateline<BR>To: PostGIS Users Discussion <<A
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A>><BR>Message-ID:<BR>
<CACowWR0YVqT5_wasbLoscmCnqNFAqVT2ioA=<A
href="mailto:yJQ6Uv_yX9Cv0A@mail.gmail.com">yJQ6Uv_yX9Cv0A@mail.gmail.com</A>><BR>Content-Type:
text/plain; charset=ISO-8859-1<BR><BR>On Tue, Sep 6, 2011 at 10:18 PM,
Paragon Corporation <<A href="mailto:lr@pcorp.us">lr@pcorp.us</A>>
wrote:<BR>> ?Sarah,<BR>> ?> ?I'm having trouble making convex hulls
that cross the international<BR>> dateline. Imagine 4 points making a
square with the international dateline<BR>> running down the middle--I
would like the convex hull to be that square, but<BR>> instead I get a
giant rectangle that goes across the entire planet. I've<BR>> done some
reading, and it sounds like GEOS generally has a hard time dealing<BR>>
with the dateline--is that accurate?<BR>> Yes GEOS? only deals with
planar coordinates.? Geography is the only<BR>> geodetic aware type and
there is no ConvexHull function for it.<BR><BR>Although you could hack one
up easily enough by copying the ideas
in<BR>ST_Buffer(geography)<BR><BR>P<BR><BR><BR>------------------------------<BR><BR>Message:
4<BR>Date: Wed, 7 Sep 2011 13:43:52 +0800<BR>From: Ben Madin <<A
href="mailto:lists@remoteinformation.com.au">lists@remoteinformation.com.au</A>><BR>Subject:
Re: [postgis-users] Problem with convex hulls that cross the<BR>
dateline<BR>To: PostGIS Users Discussion <<A
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A>><BR>Message-ID:<BR>
<<A
href="mailto:6AFE8509-2218-4CB2-956A-1269AB5CDB4B@remoteinformation.com.au">6AFE8509-2218-4CB2-956A-1269AB5CDB4B@remoteinformation.com.au</A>><BR>Content-Type:
text/plain; charset=us-ascii<BR><BR>Sarah,<BR><BR>I'm sure that there are
good reasons not to do this, but could you translate your points left or
right, create your convex hull then translate the polygon
back...?<BR><BR>Otherwise you could project it onto a custom projection that
covers your area of interest? As an example look for an equal area proj
string (I know there is one for Australia GDA94 Albers - <A
href="http://www.spatialreference.org/ref/epsg/3577"
target=_blank>http://www.spatialreference.org/ref/epsg/3577</A>) and shift
the lat and lon parameters...<BR><BR>cheers<BR><BR>Ben<BR><BR><BR>On
07/09/2011, at 1:13 AM, Sarah Berke wrote:<BR><BR>>
Hello,<BR>><BR>> 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!<BR>><BR>> 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.<BR>><BR>> CREATE TABLE example AS<BR>> SELECT
ST_ConvexHull(<BR>>
ST_Collect(ST_GeomFromText('MULTIPOINT(175 5, 175 30, -175 5, -175 30)')
))::geography(Polygon, 4326) ;<BR>><BR>><BR>> Thanks very
much,<BR>> Sarah<BR>><BR>>
_________________________________<BR>> Sarah K Berke<BR>> Postdoctoral
Scholar<BR>> Department of the Geophysical Sciences<BR>> University of
Chicago<BR>> 5734 S. Ellis Ave<BR>> Chicago, IL 60637<BR>>
_______________________________________________<BR>> postgis-users
mailing list<BR>> <A
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR>>
<A href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR><BR><BR>------------------------------<BR><BR></BLOCKQUOTE></DIV></BLOCKQUOTE></BODY></HTML>