I would like to use DotSpatial to reproject shapefiles on the fly before loading them to GeoServer. I've been looking for tutorials on how to get started with this in vain. Any pointers on where I can start will be highly appreciated.

  • it uses OSGeo therefore gdal.org to reproject the data. – Mapperz Jun 20 '12 at 13:27

Reproject a vector

When using ogr2ogr, remember that the output filename should come 'before' the input filename!

Option 1: Use the EPSG code (if known) to specify the projection ogr2ogr -t_srs EPSG:2784 output_vector input_vector

Option 2: Use an appopriate projection file (e.g. the *.prj file associated with a shapefile) to specify the new projection ogr2ogr -t_srs some_shapefile.prj output_vector input_vector

Option 3: Manually specify full Proj.4 definition string ogr2ogr -t_srs '+proj=tmerc +lat_0=21.16666666666667 +lon_0=-158 \

           +k=0.999990 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs \
           ''output_vector'' ''input_vector''

Reproject a raster

Because a square grid in one projection is not necessarily a square grid in another, reprojecting a raster layer often requires “warping”. Fortunately, this can usually be done quite easily using gdalwarp. As with other GDAL/OGR tools, the output projection can be specified using the EPSG code, an appropriate file, or the full Proj.4 definition string. Using EPSG code 2784 as an example, the general syntax is as below. In contrast to ogr2ogr, the output filename should come 'after' the input filename gdalwarp -t_srs EPSG:2784 input_raster output_raster

source: http://help.nceas.ucsb.edu/gdal

Full Documentation http://www.gdal.org/

|improve this answer|||||
  • This was very helpful, Mapperz. – okello Jun 25 '12 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.