1

I've got a tif I am trying to read in with the assigned projection/datum/etc. These are tifs exported from ArcMap with .tif.xml and .tfw files containing projection info. Is there a way in R to bring in the assigned coord.ref with the .tif

Read in TIF

r<-'example.tif' 
r <- raster(r)
r

Output

class       : RasterLayer 
dimensions  : 199, 695, 138305  (nrow, ncol, ncell)
resolution  : 50000, 50000  (x, y)
extent      : -17367529, 17382471, -4692230, 5257770  (xmin, xmax,ymin, ymax)
coord. ref. : NA 
data source : in memory
names       : layer 
values      : 0.268264, 5.886104  (min, max)

I know the projection information is contained in the the associated files: .aux.xml,.tfw, .tif.xml.

I'm looking for the best means to efficiently assign it to the tif?

The names of the tifs and associated metadata files are the convention set and produced by ArcMap export. The directory is shared as well.

  • Hi I am also get trapped in this problem, did you find a way to incorporate these files and read info from it by picture or other visible way? – cloudscomputes Mar 21 '18 at 02:40
  • I ended up assigning the projection via CRS with the projection string that I knew the file should be: something like: "equalArea <- CRS('+proj=cea +lon_0=195 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +ellps=WGS84 +units=m +no_defs')" or mod_proj <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0" – Tyler Gagne Mar 21 '18 at 19:09

1 Answers1

1

The projection is normally stored directly in the tif (as a geotiff). It seems arcMAP also store it in the .tif.xml but I don't really know why as it doesn't have to. Anyway, here is something you can try:

1) find your projection. Either the proj4string or the EPSG (http://spatialreference.org)

2) assign it to your raster: proj4string(r) <- CRS("+init=EPSG:4326")

This is ok if the projection your assigning is the real projection in which the data are.

Bastien
  • 3,007
  • 20
  • 38