[Gdal-dev] Tool to convert shapefile from [-180, 180] to [0, 360] range

Daniel Morissette dmorissette at mapgears.com
Wed Jun 14 16:56:26 EDT 2006


Mateusz Loskot wrote:
> 
> I created small utility on basis of ogr2ogr according your needs, just
> for fun and practice :-)
> I attached it as a 180to360.cpp file, so it's a C++ application.
> I hope this attachement will not be cutted off by the gdal-dev mailer.
> It works only with shapefiles.
> 
> This utility just adds 180 to every x coordinate.
> So, it works well only if input coordinates are in range frm -180 to
> 180, but it does not check it.

Hi Mateusz,

Thanks for the little program, that's what I was thinking of doing too. 
In case anyone is interested, I have attached a new version that I 
modified it a little bit to:

1- Shift by +360 instead of +180. i.e. -50 degrees = +310 degrees
2- Shift coordinates only if the centroid of the source feature is in 
the [-180,0] range

One last thing to do would be support for geometries other than points 
(at least linestrings and polygons).

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 180to360.cpp
Type: text/x-c++src
Size: 12385 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060614/1ca56acd/180to360.bin


More information about the Gdal-dev mailing list