[postgis-users] Transforming Lat/Long

Benjamin Wragg bwragg at tpg.com.au
Thu Jul 17 17:58:35 PDT 2003


Hi list,
 
I'm currently trying to transform a polygon which is a rectangle. I get
give extent coordinates (minx,miny,maxx,maxy) in lat/long's and I then
build a polygon out of it, transforming it into a Mercator projection
with a +150 longitude shift. I use a query like:
 

    UPDATE extents SET
the_geom=transform(GeometryFromText('MULTIPOLYGON(((-180 -70 ,-180
85,180 85 ,180 -70,-180 -70)))',4326),999001) WHERE id=13739;

 
The 999001 projection is a custom projection in the spatial_ref_sys
table. Its definition is identical to the Mercator projection (srid of
54004) except for an addition of "+lon_0=150" in the proj4text.
 
When I run the query above I get a rectangle draw (via mapserver) as a
straight line running from 85 to -70 at the point where 180/-180 is. It
should be a rectangle covering the entire globe. I understand that
PostGIS is taking the coordinates that I pass and transforming the -180
and +180 to be the same point in metres. You can see this in the
geometry below:
 

SRID=999001;MULTIPOLYGON(((3339584.7237982
-11028513.6309201,3339584.7237982 19929239.1133792,3339584.7237982
19929239.1133792,3339584.7237982 -11028513.6309201,3339584.7237982
-11028513.6309201)))

 
I've checked this using cs2cs like follows:
 

cs2cs +proj=latlong +datum=WGS84 +to +proj=merc +lon_0=150
0
-16697923.62    0.00 0.00
 
180
3339584.72    0.00 0.00
 
-180
3339584.72    0.00 0.00

 
Does any one have any suggestion on how I can ensure that the polygon I
create covers the entire globe?
 
Thanks,
 
Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20030718/5860edf2/attachment.html>


More information about the postgis-users mailing list