Sunday, February 22, 2009

Changing the projection of a spatial data using ogr2ogr and gdalwarp

Changing the projection of a shapefile using ogr2ogr :

Download and install ogr/gdal (yes, it's free).

To create output.shp with the WGS84 (4326) projection, use the following syntax :

ogr2ogr output.shp -t_srs "EPSG:4326" input.shp

To simply extract Features 1,2,3 and export into GML :

ogr2ogr output.gml input.tab -f "GML" -where "fid in (1,2,3)"


Similarly, use gdalwarp for raster data :

gdalwarp -t_srs 'EPSG:4326' input.tif output.tif

voilĂ 

No comments:

Post a Comment