[GIS] Convert coordinates from WGS84 to Gauss-Krüger Zone

coordinatesrwgs84

I m currently trying to convert coordinates which come in a csv file in Lon/Lat to Gauss Krüger (Zone 4) using R. My script works perfectly fine, except that the resulting shapefile with the converted points are a little off where they should be (ranging from ~18 to 40m). I guess something is wrong with my spTransform input. As the original CSV didn't come with any metadata, i definded the CRS to WGS84 (the points were recorded with a garmin gps device)

proj4string(results_eDNA)=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")

where results_eDNA is the dataframe including the coordinates

I then try to transform it with:

coor_eDNA<- spTransform(results_eDNA, CRS("+proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000
 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs +towgs84=23.92,-141.27,-80.9,-0,0.35,0.82,-0.12"))

i think the error comes from the numbers following "+towgs84=", but i have no idea how to figure out which would be the right ones for me. I tried all posibilitys i found on spatialreference.org but with no success.

Best Answer

You are mixing datum shift values:

+towgs84=23.92,-141.27,-80.9,-0,0.35,0.82,-0.12

is valid for the Pulkovo 1942 datum, based on the Russian Krassowsky ellipsoid. See https://epsg.io/2398


+datum=potsdam

is valid for the German DHDN Gauss-Krueger CRS based on the bessel ellipsoid and Potsdam datum, see https://epsg.io/31468. The datum shift to WGS84 is

+towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7

Both CRS have been used in Eastern Germany, so you have to make sure which datum your data is in.