[postgis-users] problem with data crossing the date line

pcreso at pcreso.com pcreso at pcreso.com
Thu Sep 22 21:26:48 PDT 2011


Or use 0-360 longitudes for a single geometry polygon. Valid EPSG:4326 coordinate space.

The problem then arises if you have other data in a +-180 space...

Brent Wood

--- On Fri, 9/23/11, Paul Ramsey <pramsey at opengeo.org> wrote:

From: Paul Ramsey <pramsey at opengeo.org>
Subject: Re: [postgis-users] problem with data crossing the date line
To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
Date: Friday, September 23, 2011, 7:47 AM

Note that while a multi-poly split at the dateline will (a) render
find and (b) give right answers to all functions, it will do bad
things (if you have enough of them) to your index, since the index
bbox of the feature will cover the whole world. So even tiny queries
in the middle of the world will end up wading through the split
features as possible cases turned up by the index.

P.

On Thu, Sep 22, 2011 at 12:40 PM, Jesse Bishop <jbishop at whrc.org> wrote:
>
> Hi Puneet,
> We ran into this issue as well.  As a workaround for display in QGIS, we store those features that cross the date line as MULTIPOLYGONS that are split at 180/-180 line.  It is not ideal, but it works for display.  It does not work for some operations like ST_Centroid but others like ST_Contains will work.
> Jesse
> Examples:
> As displayed in QGIS:
>  . . .
> From the database perspective:
> smddb_dev=# SELECT AsText(scene_geom) FROM scene_locator WHERE id = 28716;
>                                                                                                   astext
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>  MULTIPOLYGON(((179.665 -17.733,180 -17.6550440252,180 -18.2032131661,179.794 -18.251,179.665 -17.733)),((-180 -17.6550440252,-179.699 -17.585,-179.568 -18.103,-180 -18.2032131661,-180 -17.6550440252)))
> (1 row)
> smddb_dev=# SELECT AsText(ST_Centroid(scene_geom)) FROM scene_locator WHERE id = 28716;
>                    astext
> --------------------------------------------
>  POINT(-27.1147737791952 -17.9181176096631)
> (1 row)
>
> smddb_dev=# SELECT ST_Contains(scene_geom, GeomFromText('POINT(-179.8 -17.8)', 4326)) FROM scene_locator WHERE id = 28716;
>  st_contains
> -------------
>  t
> (1 row)
> On Sep 15, 2011, at 4:06 PM, Paul Ramsey wrote:
>
> Might want to cross-post this to QGIS, it's more their problem than ours.
>
> P
>
> On Thu, Sep 15, 2011 at 1:22 PM, Puneet Kishor <punk.kish at gmail.com> wrote:
>
> well, I've reached that point where I have to deal with data crossing the date line. I have kept a file on my Dropbox/Public folder [http://dl.dropbox.com/u/3526821/PA.gmt] which has a series of lat/lng pairs, one per line, making a single polygon. If I insert them into PostGIS as GEOMETRY, the resulting polygon is messed up. If I insert them as GEOGRAPHY, I can't view the polygon in Quantum GIS.
>
> Any suggestion on the best way to handle this?
>
> Puneet.
>
> _______________________________________________
>
> postgis-users mailing list
>
> postgis-users at postgis.refractions.net
>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110922/e7a09569/attachment.html>


More information about the postgis-users mailing list