I have been able to reproduce this on my machine and have found a solution. The "data" file is quite large so I don't post it here but as an example, see below. There is some raster file data which is loaded into the workspace. I perform some calculations, and save a copy. "data" has the crs given below.
> writeRaster(data, "~/R_work/Mackenzie/2015_06_binary.tif",
+ "GTiff", datatype = "INT1U", overwrite = T, options = c("COMPRESS=LZW", "TFW=YES"))
> data
class : RasterLayer
dimensions : 24099, 13793, 332397507 (nrow, ncol, ncell)
resolution : 30, 30 (x, y)
extent : -15267810, -14854020, 10270650, 10993620 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs
names : layer
values : 0, 1 (min, max)
After reading the dataset back in and looking at the crs, it appears different. This difference doesn't allow it to be read into ArcGIS or Python.
> data <- raster("~/R_work/Mackenzie/2015_06_binary.tif")
> crs(data)
CRS arguments:
+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs
However, if we use the CRS function from sp (not crs from raster) this seems to be fixed. Note that the crs of data3 is missing the EPSG - this is fine, as the other properties are preserved. Observe:
data2 <- data
crs(data2) <- CRS('+init=EPSG:3857')
> crs(data2)
CRS arguments:
+init=EPSG:3857 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0
+units=m +nadgrids=@null +no_defs
writeRaster(data2, "C:/Users/lvulis/Documents/deltas/R_work/Mackenzie/2015_06_binary2.tif",
"GTiff", datatype = "INT1U", overwrite = T, options = c("COMPRESS=LZW", "TFW=YES"))
data3 <- raster("C:/Users/lvulis/Documents/deltas/R_work/Mackenzie/2015_06_binary2.tif")
> crs(data3)
CRS arguments:
+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m
+nadgrids=@null +no_defs
writeRaster(foo, "foo.tif")
do store projection info,+ellps
and the+towgs84
parameters. The NAD83 datum is defined here: epsg-registry.org/export.htm?wkt=urn:ogc:def:crs:EPSG::4269.