Re: [postgis-users] Problem with convex hulls that cross the dateline
On Fri, Sep 9, 2011 at 3:07 AM, wrote: > > Welcome to maritime GIS around New Zealand :-) > > The standard problem! > > Work in a 0-360 space instead of +-180. EPSG4326 supports both extents > (according to EPSG anyway). > The problem is the lack of a flag to specify which you want. See if ST_Wrap would help you: http://trac.osgeo.org/postgis/ticket/454 --strk; Free GIS & Flash consultant/developer http://strk.keybit.net/services.html ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Problem with convex hulls that cross the dateline
Welcome to maritime GIS around New Zealand :-) The standard problem! Work in a 0-360 space instead of +-180. EPSG4326 supports both extents (according to EPSG anyway). The problem is the lack of a flag to specify which you want. Improvements in the geography datatype will help in this area. There are a few workarounds, but the only real solution is a mod 360 approach, as used in GMT & in the geography datatype (sort of) Brent Wood --- On Fri, 9/9/11, Sarah Berke wrote: From: Sarah Berke Subject: Re: [postgis-users] Problem with convex hulls that cross the dateline To: postgis-users@postgis.refractions.net Date: Friday, September 9, 2011, 7:22 AM 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? Thanks, Sarah _ Sarah K Berke Postdoctoral Scholar Department of the Geophysical Sciences University of Chicago 5734 S. Ellis Ave Chicago, IL 60637 -- Message: 2 Date: Wed, 7 Sep 2011 01:18:51 -0400 From: "Paragon Corporation" Subject: Re: [postgis-users] Problem with convex hulls that cross the dateline To: "'PostGIS Users Discussion'" Message-ID: Content-Type: text/plain; charset="us-ascii" Sarah, > 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? Yes GEOS only deals with planar coordinates. Geography is the only geodetic aware type and there is no ConvexHull function for it. > 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? No. You should use a planar projection of some sort. 4326 squashed on a map is no good. Paul Ramsey might have some thoughts on the matter. > 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! You might want to check out http://spatialreference.org > 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. > CREATE TABLE example AS > SELECT ST_ConvexHull( > ST_Collect(ST_GeomFromText('MULTIPOINT(175 5, 175 30, -175 5, -175 30)') ))::geography(Polygon, 4326) ; My guess is you'll have to cut your area into pieces. Still then its not that pretty when you try to rejoin. Sorry couldn't be more help, Regina http://www.postgis.us -- next part -- An HTML attachment was scrubbed... URL: <http://postgis.refractions.net/pipermail/postgis-users/attachments/20110907/dca69b0a/attachment-0001.html> -------------- Message: 3 Date: Tue, 6 Sep 2011 22:21:48 -0700 From: Paul Ramsey Subject: Re: [postgis-users] Problem with convex hulls that cross the dateline To: PostGIS Users Discussion Message-ID: Content-Type: text/plain; charset=ISO-8859-1 On Tue, Sep 6, 2011 at 10:18 PM, Paragon Corporation wrote: > ?Sarah, > ?> ?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? > Yes GEOS? only deals with planar coordinates.? Geography is the only > geodetic aware type and there is no ConvexHull function for it. Although you could hack one up easily enough by copying the ideas in ST_Buffer(geography) P -- Message: 4 Date: Wed, 7 Sep
Re: [postgis-users] Problem with convex hulls that cross the dateline
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? Thanks, Sarah _ Sarah K Berke Postdoctoral Scholar Department of the Geophysical Sciences University of Chicago 5734 S. Ellis Ave Chicago, IL 60637 > -- > > Message: 2 > Date: Wed, 7 Sep 2011 01:18:51 -0400 > From: "Paragon Corporation" > Subject: Re: [postgis-users] Problem with convex hulls that cross the >dateline > To: "'PostGIS Users Discussion'" > > Message-ID: > Content-Type: text/plain; charset="us-ascii" > > Sarah, > > 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? > Yes GEOS only deals with planar coordinates. Geography is the only > geodetic aware type and there is no ConvexHull function for it. > > > 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? > No. You should use a planar projection of some sort. 4326 squashed on a > map is no good. Paul Ramsey might have some thoughts on the matter. > > > 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! > > You might want to check out http://spatialreference.org > > > 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. > > > CREATE TABLE example AS > > SELECT ST_ConvexHull( > > ST_Collect(ST_GeomFromText('MULTIPOINT(175 5, 175 30, -175 5, -175 > 30)') ))::geography(Polygon, 4326) ; > > My guess is you'll have to cut your area into pieces. Still then its not > that pretty when you try to rejoin. > > Sorry couldn't be more help, > Regina > http://www.postgis.us > > -- next part ---------- > An HTML attachment was scrubbed... > URL: < > http://postgis.refractions.net/pipermail/postgis-users/attachments/20110907/dca69b0a/attachment-0001.html > > > > -- > > Message: 3 > Date: Tue, 6 Sep 2011 22:21:48 -0700 > From: Paul Ramsey > Subject: Re: [postgis-users] Problem with convex hulls that cross the >dateline > To: PostGIS Users Discussion > Message-ID: > > > Content-Type: text/plain; charset=ISO-8859-1 > > On Tue, Sep 6, 2011 at 10:18 PM, Paragon Corporation wrote: > > ?Sarah, > > ?> ?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? > > Yes GEOS? only deals with planar coordinates.? Geography is the only > > geodetic aware type and there is no ConvexHull function for it. > > Although you could hack one up easily enough by copying the ideas in > ST_Buffer(geography) > > P > > > -- > > Message: 4 > Date: Wed, 7 Sep 2011 13:43:52 +0800 > From: Ben Madin > Subject: Re: [postgis-users] Problem with convex hulls that cross the >dateline > To: PostGIS Users Discussion > Message-ID: ><6afe8509-2218-4cb2-956a-1269ab5cd...@remoteinformation.com.au> > Content-Type: text/plain
Re: [postgis-users] Problem with convex hulls that cross the dateline
Sarah, 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...? 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 - http://www.spatialreference.org/ref/epsg/3577) and shift the lat and lon parameters... cheers Ben On 07/09/2011, at 1:13 AM, Sarah Berke wrote: > Hello, > > 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. > > CREATE TABLE example AS > SELECT ST_ConvexHull( > ST_Collect(ST_GeomFromText('MULTIPOINT(175 5, 175 30, -175 5, -175 30)') > ))::geography(Polygon, 4326) ; > > > Thanks very much, > Sarah > > _ > Sarah K Berke > Postdoctoral Scholar > Department of the Geophysical Sciences > University of Chicago > 5734 S. Ellis Ave > Chicago, IL 60637 > ___ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Problem with convex hulls that cross the dateline
On Tue, Sep 6, 2011 at 10:18 PM, Paragon Corporation wrote: > Sarah, > > 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? > Yes GEOS only deals with planar coordinates. Geography is the only > geodetic aware type and there is no ConvexHull function for it. Although you could hack one up easily enough by copying the ideas in ST_Buffer(geography) P ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Problem with convex hulls that cross the dateline
Sarah, > 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? Yes GEOS only deals with planar coordinates. Geography is the only geodetic aware type and there is no ConvexHull function for it. > 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? No. You should use a planar projection of some sort. 4326 squashed on a map is no good. Paul Ramsey might have some thoughts on the matter. > 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! You might want to check out http://spatialreference.org > 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. > CREATE TABLE example AS > SELECT ST_ConvexHull( > ST_Collect(ST_GeomFromText('MULTIPOINT(175 5, 175 30, -175 5, -175 30)') ))::geography(Polygon, 4326) ; My guess is you'll have to cut your area into pieces. Still then its not that pretty when you try to rejoin. Sorry couldn't be more help, Regina http://www.postgis.us ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Problem with convex hulls that cross the dateline
Hello, 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. CREATE TABLE example AS SELECT ST_ConvexHull( ST_Collect(ST_GeomFromText('MULTIPOINT(175 5, 175 30, -175 5, -175 30)') ))::geography(Polygon, 4326) ; Thanks very much, Sarah _ Sarah K Berke Postdoctoral Scholar Department of the Geophysical Sciences University of Chicago 5734 S. Ellis Ave Chicago, IL 60637 ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users