[postgis-users] transform & 180 degree problem

Paul Ramsey pramsey at refractions.net
Mon Apr 19 18:30:44 PDT 2004


When you say you want 0-360 degrees, what you are really saying is you 
want a different prime meridian (with 0-360 there is still a wraparound 
problem, it just happens to occur in Greenwich :)

So, instead of translating your data into normal latlong, try 
translating it into a custom latlong that has the prime meridian 
somewhere more to your liking, like Canberra perhaps.

So, add yet another projection to your spatial_ref_sys file,

INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, proj4text) 
VALUES (500001,'BWOOD',500001,'+proj=latlong +pm=149 +ellps=WGS84');

Note that you need proj-4.4.7 for this to work, prime meridian support 
was not added until more recently. And depending on the PostGIS 
internals (whether we use pj_transform or not) it still might not work.

Incidentally, doing overlays and whatnot in latlong is a PITA, because 
you can never simply express distances in metres. You might be better 
served with a planar projection for your working area.

Paul

Wood Brent wrote:

> I used the transform function to convert some mercator data to lat/long.
> (Thanks for the help on the SRID parameters)
> 
> The data crosses the 180 meridian, & the result of the transform is a -180 to
> +180 dataset. 
> 
> As the attached image of this plotted in QGIS shows, a 0-360 longitude option
> would be helpful :-(
> 
> Apart from a script to process the WKT version of the transform data so all -ve
> longitudes are added to 360 to create a useful dataset, then loaded into the
> target table, is there anything I can do within PosGIS/QGIS to have +-180 &
> 0-360  data overlay, or convert between them?
> 
> Is there any flag the spatial_ref_sys parameters can use to force a 0-360
> instead of +-180 output?
> 
> Is there a SRID (I'm using 4326 for the lat long data) which forces a 0-360
> from transform?
> 
> 
> Thanks,
> 
>    Brent Wood  
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632
      \_



More information about the postgis-users mailing list