[FWTools] conversion/transformation

Christine Spietz spietz at fh-bingen.de
Tue May 23 02:11:07 EDT 2006

Hi Mateusz,

Thank you for the detailed information. It helped a lot!

If I understodd right I use the -s_srs-parameter only if

- I have no prj-file (but know the geographic coordinates sytem of the 
input-file) or if I want to omit the prj-file.
- I transform from an Shapefile to something else (because only the 
Shapefile might have a prj-file)

Thanks for help!


>> is there a detailed documentation on the mechanism of
>> conversion/transformation with ogr2ogr?
>> Only things I was able to find were:
>> -a_srs srs_def = assign an output srs
>> -t_srs srs_def = Reproject/transform to this SRS on output
>> -s_srs srs_def = override source srs
>> I need a more detailed description on what especially is going on if
>> you assign one of those parameters to ogr2ogr.
> -a_srs option is used to "assign" coordinate system to output file e.g.
> during copying.
> In example, I have Shapefile called 'poland' (.shp|.dbf|.shx) and I know
> it stores coordiantes in geographic coordinates sytem WGS 84 but I don't
> have a poland.prj file, so I can use ogr2ogr utility to copy poland
> shapefile to poland2 shapefile and assign coordinate system:
> $ ogr2ogr -a_srs 'EPSG:4326' -f "ESRI Shapefile" poland2.shp poland.shp
> $ ls poland2.*
> poland2.dbf  poland2.prj  poland2.shp  poland2.shx
> $ cat poland2.prj
> GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]m
> NOTE: I run those commands on Linux, so I use here 'ls' and 'cat' commands
> -s_srs option is used to override SRS for input dataset if there is any
> assigned.
> - t_srs is used to tell ogr2ogr what is the target projection; to which
> projection ogr2ogr should transform your input data.
> In example, I have poland2 shapefile and in the example above I assigned
> WGS84 coordinate system to it.
> Now, I want to project this poland2 shapefile from WGS 84 to "Poland
> CS92" coordinate system (it's used widely in Poland).
> So, I have two choices:
> 1) I can use poland2.prj file generated in the example above:
> ogr2ogr -t_srs 'EPSG:2180' -f "ESRI Shapefile" poland4.shp poland2.shp
> 2) I can omit the poland2.prj file and tell ogr2ogr to use SRS defined
> in -s_srs option as an input SRS :
> ogr2ogr -s_srs 'EPSG:4326' -t_srs 'EPSG:2180' -f "ESRI Shapefile"
> poland4.shp poland2.shp
> In both cases, the output is the same:
> shapefile called 'poland4' projected to "Poland CS92" (EPSG:2180)
> I hope my explanation is helpful.
> Cheers
> -- 
> Mateusz Łoskot
> http://mateusz.loskot.net
> _______________________________________________
> FWTools mailing list
> FWTools at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/fwtools
> http://fwtools.maptools.org/

More information about the FWTools mailing list