Thank you very much Andre. I'm still puzzled how I can tell ogr2ogr to convert the coordinates themselves along with the conversion of the CRS (e.g. from EPSG:3008 to EPSG:3006).
But maybe that is because I have not yet managed to retrieve from the .shp and .prj files the information that a certain shapefile is e.g. EPSG:3008. It seems I need an interpreter of the output from ogrinfo that can translate that rather complex output into a simple EPSG-code. I imagine that it then becomes much easier to convert both CRS and coordinate values from any shapefile into anther shapfile with any other CRS you'd like. Thanks again! //Erik On 06/08/17 07:42, Andre Joost wrote: > Am 06.08.2017 um 02:22 schrieb Erik Josefsson: >> Hello, >> >> 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 >> this? >> >> 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. > > HTH, > André Joost > > > _______________________________________________ > Qgis-user mailing list > Qgisemail@example.com > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Description: OpenPGP digital signature
_______________________________________________ Qgis-user mailing list Qgisfirstname.lastname@example.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user