Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
    
it uses OSGeo therefore gdal.org to reproject the data. –  Mapperz Jun 20 '12 at 13:27
add comment

1 Answer

up vote 1 down vote accepted

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/

share|improve this answer
    
Thanks. I'll try it out and post my findings. –  okello Jun 20 '12 at 13:39
    
This was very helpful, Mapperz. –  okello Jun 25 '12 at 6:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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