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

Paul Ramsey pramsey at opengeo.org
Thu Sep 22 12:47:20 PDT 2011


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
>



More information about the postgis-users mailing list