[postgis-users] problem with data crossing the date line
Jesse Bishop
jbishop at whrc.org
Thu Sep 22 12:40:18 PDT 2011
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110922/694f1f13/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture 1.png
Type: image/png
Size: 5222 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110922/694f1f13/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture 2.png
Type: image/png
Size: 4951 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110922/694f1f13/attachment-0001.png>
More information about the postgis-users
mailing list