I have a CSV-list of coordinates that I know are coordinates in Gauß-Krüger (Transverse Mercator) and I want to transform them to UTM in R with GDAL.

I read the csv in, separated the columns, added the original source proj4string while creating a SpatialPoints object. Then I tried to transform the data with ogr2ogr but always get the error message:

"Error in as.character.default(new("SpatialPoints", coords = c(3480702.68, : no method for coercing this S4 class to a vector"


ExamplePoints <- read.csv2("C:/Users/Desktop/Test.csv", header = TRUE,  
  dec = ",")

points_SRC <- ExamplePoints[3:4]

ExamplePoints_SRC <- SpatialPoints(points_SRC,   
  proj4string=CRS("+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 
  +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7 +units=m 

Transform_test <- ogr2ogr(src_datasource_name = ExamplePoints_SRC,      
  dst_datasource_name = "C:/Users/Desktop/Test.shp", f = "ESRI 
  Shapefile", t_srs = "+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 
  +x_0=32500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m 
  +no_defs", s_srs = "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 
  +y_0=0 +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7  
  +units=m +no_defs", a_srs= "EPSG:4647")

I do not understand the error message. What kind of input does ogr2ogr expect instead? I could not get an answer to this until now unforunately.

Did anyone experience a similar error or does understand what GDAL wants instead?

This is how the CSV file looks like in the editor (the decimal separator is ',' and the column separator is ';' :

point number;source CRS;x;y;target CRS;x;y

This is the table of coordinates before the making a SpatialPoint object out of it: This is the table of coordinates before the making a SpatialPoint object out of it

  • 1
    Can you include the content of the Test.csv file (a few lines) instead of the image of the table? Feb 9, 2019 at 18:42
  • I added them in the question. I hope that is visible.
    – Li12
    Feb 10, 2019 at 12:49
  • Why don't you just use spTransform instead? Feb 10, 2019 at 13:59
  • Because with spTransform I did not see a possibility to assign a specific defintion of the grid, if I am not mistaken. I would like to conduct that in the next step though for comparison reasons (... +units=m +nadgrids"PATH TO NTV2 GRID")
    – Li12
    Feb 11, 2019 at 9:58

1 Answer 1


In the documentation for ogr2ogr:


     ogr2ogr(src_datasource_name, dst_datasource_name, layer, f, append, 


src_datasource_name: Character. Input vector file.
dst_datasource_name: Character. Output vector file.

these arguments are Character. Input vector file. - they are NOT spatial R objects. They would be, for example, paths to shapefiles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.