Search code examples
rrasterrgdalhdr

Open .hdr .stx .prj and .flt in R


I am looking to plot a raster of precipitation data, and have access to a folder containing .hdr .stx .prj and .flt files. Would you have any advice on how to open these files or one of them in R to access the precipitation data? Thank you very much!

Here are some examples of code I have tried:

map <- readGDAL("mean_Annual_precipitation_1981_2012.hdr")
Error in .local(.Object, ...) : 
  Couldn't find data values in ASCII Grid file.

map <- raster("mean_Annual_precipitation_1981_2012.hdr")
Error in .local(.Object, ...) : 

Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer",  : 
  Cannot create a RasterLayer object from this file. (file does not exist)

Solution

  • I think this will work:

    map <- raster("mean_Annual_precipitation_1981_2012.flt")