[postgis-users] postgis help!!

Brent Wood pcreso at pcreso.com
Tue May 16 03:37:57 PDT 2006


Hi y'all...
 
It serves me right for pointing out to others using competing commercial
products how much better PostGIS is for our use near the dateline :-)


Being based in New Zealand, and working with data that crosses the 180
meridian, we have stored our data in Postgis using lat/long, with 0-360
longitudes (not +-180) to give us an NZ-centric view of things.
 
This wasn't possible in Oracle spatial or Informix, or SDE, so I had
things easy....  Sigh...
 
I just upgraded to the current versions of Postgres & PostGIS, & started
loading data....
 
For some islands east of NZ that I want to plot on the right of NZ, (east
is to the right isn't it, not on the left at the other side of the world?)
I applied the following sql.
 
 psql -d corax -c "update $NAME 
                   set the_geom=translate(the_geom, 360.0, 0.0, 0.0);"

The longitudes all jumped 720 degrees. Re-running it with the x translate
value at -360 at least brought them back. A translate with x offset of 180
actually worked, & moved -176 to +184, just as it used to with v0.8.
 
I figure this is a bug in translate?
 
Anyway, I then looked at the data with QGIS (cvs version - still a bit
buggy). I couldn't see any of the data from the tables I'd translated.
QGIS was setting the map extent to the old -176 region, all the way around
the world, despite the actual coords being at 184.
 
Following this up in psql got an interesting result:

corax=# select astext(the_geom), astext(envelope(the_geom)) from
         chat_shelt_blt_cl limit 1;
                                                    astext
|
astext

-----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 MULTILINESTRING((183.421418 -43.969658,183.422853 -43.974923,183.422889
-43.975053,183.428435 -43.973203)) | POLYGON((-176.578582763672
-43.9750556945801,-176.578582763672 -43.9696578979492,-176.571563720703
-43.9696578979492,-176.571563720703 -43.9750556945801,-176.578582763672
-43.9750556945801))
(1 row)

 
The data (linestring) is indeed at 183 degrees (in my 0-360 degree
system), but Postgis is returning an envelope which is resetting it to
+-180.


Please tell me this is a bug, or I need to do something to fix the values
returned by envelope (reset bbox for the geometry data or something?)

...not the new way PostGIS is supposed to behave.
 
 
 Thanks,
 
   Brent Wood
 




More information about the postgis-users mailing list