Batch map coordinate transformation

There is plenty of open-source tools available for coordinate transformation.

TODO: Finish!!!

Proj.4

The base for such transformation is Proj.4 library: http://trac.osgeo.org/proj 
Proj.4 has it's own format of definition of the coordinate system. All the conversions are done trough WGS84 datum.

Typical example:

cs2cs ....

+init=epsg:...

Alternative transformation algorithms are implemented in: CS-Map Open Source available as part of MetaCRS http://metacrs.osgeo.org/ and in the GeoTools project.

OGR and GDAL


Another alternative for batch conversion of coordinates 

Specification in WKT form, or EPSG/ESRI code, ... based on Proj.4

gdaltranform

Transformation of rasters:

gdalwarp

Transformation of vectors (shape files for example):

ogr2ogr

Python

When you need coordinate transformation in a scripting languages like Perl/Python... etc. the easiest is to use  


example with OGR:

import osr

wkt = '''PROJCS["unnamed",
     GEOGCS["International 1909 (Hayford)",
         DATUM["unknown",
             SPHEROID["intl",6378388,297]],
         PRIMEM["Greenwich",0],
         UNIT["degree",0.0174532925199433]],
     PROJECTION["New_Zealand_Map_Grid"],
     PARAMETER["latitude_of_origin",-41],
     PARAMETER["central_meridian",173],
     PARAMETER["false_easting",2510000],
     PARAMETER["false_northing",6023150],
     UNIT["Meter",1],
     EXTENSION["PROJ4","+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000
+y_0=6023150 +ellps=intl  +units=m +nadgrids=nzgd2kgrid0005.gsb +wktext"]]'''

nzmg = osr.SpatialReference()
#nzmg.ImportFromEPSG(27200)

nzmg.ImportFromWkt(wkt)

wgs = osr.SpatialReference()
wgs.ImportFromEPSG(4326)

xform = osr.CoordinateTransformation(nzmg, wgs)
print xform.TransformPoint(2660000,6007000)

#(174.78679521944085, -41.129876605353665, 1.9744038581848145e-07)

Comments