Not the best practice, but somethimes I need to change between ArcGIS 10.6 and R (version 3.6.1) to process my shapefiles. For example, I want to read my shapefile in R -> process it -> export it back to ArcGIS.
But, the projection of my data changes in between: I read the shapefile in one coordinate system, export it in same CRS, but ArcGIS reads it as different projection.
Let's see on watershed dataset:
I work on Finland watersheds. In ArcGIS, it has projection
EUREF_FIN_TM35FIN, WKID 3067
After loading this file to R, the projection is a string:
library(rgdal) library(sp) setwd("U:/rawData/Finland/watershed/valuma") watershed = readOGR(dsn = "U:/rawData/Finland/watershed/valuma", layer = "Jako3") proj4string(watershed) #  "+proj=utm +zone=35 +ellps=GRS80 +units=m +no_defs"
This is how the this projection string should look like reffering to spatialreference.org:
+proj=utm +zone=35 +ellps=GRS80 +units=m +no_defs
But, after exporting this file to new .shp:
# Add the stand geometry writeOGR(obj = watershed, dsn = getwd(), layer = "watershed_no", driver = "ESRI Shapefile", overwrite_layer=TRUE)
ArcGIS now reads this projection as Custom projection (even not listed within ArcGIS library!!!) as
I have tried to transform my data to correct CRS before exported in R:
watershed.t <- spTransform(watershed, CRS("+init=epsg:3067"))
But, ArcGIS still reads this as a
Custom CRS. How to define my
CRS in R, to be correctly read in ArcGIS? Or how can I avoid its change between softwares?
I have tried both suggestions:
watershed@proj4string@projargs <- paste0('+init=epsg:3067 ', watershed@proj4string@projargs)
transform my data using
spTranformand specify epsg:
watershed.t <- spTransform(watershed, CRSargs(CRS("+init=epsg:3067")))
but they both produce the same output:
Custom projection UTM_Zone_35_Northern_Hemisphere
Authority: Custom in ArcGIS 10.6.
Do you have any other suggestions?