mateusz at loskot.net
Mon May 22 09:46:45 EDT 2006
Christine Spietz wrote:
> Hi there,
> 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.
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
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
- 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"
In both cases, the output is the same:
shapefile called 'poland4' projected to "Poland CS92" (EPSG:2180)
I hope my explanation is helpful.
More information about the FWTools