[postgis-users] Possible function to convert +-180 features to 0-360 longitudes

pcreso at pcreso.com pcreso at pcreso.com
Thu Jun 19 20:52:58 PDT 2008


Hi,

I believe such a function is feasible, but my programming skills are pretty minimal, so any advice appreciated.

I have data in a custom mercator projection, crossing 180 degrees. I can use ST_transform to generate a lat/long (EPSG:4326) version, but only in a +-180 longtitudinal space, which results in features at each side of a map with lines joining them running across the map.

It seems feasible to have a function (to360 ?) which reads every point/vertex in every component of every feature in a geometry column, & if the longitude coordinate is <0, adds 360 to it. The result would be a 0-360 version of the data to be plotted in a 180 centric map.

Given the original data was not split at 180, this should simply rebuild the correct topology of the features. I'm not looking to split or join features which cross the 180 or 0 longitude lines.

So, am I wrong in any of my assumptions, & if not, can anyone point me to some relevant examples to learn from or suggest how I should go about writing such a function? 


Thanks,

   Brent Wood



More information about the postgis-users mailing list