Am 06.08.2017 um 02:22 schrieb Erik Josefsson:

I have a handful of zip archives containing original shapefiles with
different coordinate reference systems (e.g. SGER:3008 and SGER:3021).

I want to extract and convert them all to SGER:3006 and thought that
ogr2ogr would do the job, but I don't find intelligible instructions on
how to use the srs-parameters: -s_srs, -t_srs and -a_srs.

You can either use -s_srs and -t_srs to reproject from one CRS to another, or use -a_srs to assign a CRS if the source data has no CRS information (like CSV), or has a wrong CRS (it is misplaced compared to other data).

If the source data has a .prj file, the CRS information is stored inside that. But beware that EPSG codes and datum shifts (+towgs84) are not stored in .prj files. GDAL will try to auto-guess the EPSG code,but sometimes fails. In that case, no datum shift will be applied. From your example, EPSG:3021 must have a datum shift to WGS84, while the others are based on ellipsoids with no shift to the WGS84 definition. So it is safe to use -s_srs EPSG:3021 (together with -t_srs) for that data.

Do I have to know the coordinate reference system of each original shape
file to use ogr2ogr successfully? If so, how do I retrieve that information?

ogrinfo will report the CRS of every vector file supported by GDAL.

Or should I just override the original coordinate reference system like

ogr2ogr -f 'ESRI Shapefile' -s_srs EPSG:3006 -t_srs EPSG:3006 -a_srs
EPSG:3006 A.shp B.shp

That will be wrong in most cases.

André Joost

Qgis-user mailing list
List info:

Reply via email to