I'm re-opening this question (Open JPEG2000 (Sentinel 2) in R). I'm working on a Mac OS X Yosemite 10.10.5.
I would like to be able to read jp2 format images with R without translating it to .tif format or anything of that kind.
I followed what have been explained in this question, but I'm still not able to open jp2 images.
library(rgdal) Le chargement a nécessité le package : sp rgdal: version: 1.2-7, (SVN revision 660) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 2.1.2, released 2016/10/24 Path to GDAL shared files: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/gdal Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491] Path to PROJ.4 shared files: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/proj Linking to sp version: 1.2-4
s04 <- readGDAL("/Users/martinmonziols/Documents/ENSAE/Stage TheGreenData/L2A_T30UYA_20170509T105621_B04_10m.jp2") Error in .local(.Object, ...) :
So, I checked the drivers
It seems that I don't have any driver for jp2 files. But what is strange to me is that when running these lines in Terminal
MacBook-Air-de-Martin:~ martinmonziols$ gdalinfo --version GDAL 2.1.3, released 2017/20/01
I have in particular this line in the table of all drivers:
JPEG2000 -raster,vector- (rwv): JPEG-2000 part 1 (ISO/IEC 15444-1), based on Jasper library
which means that I have somewhere a driver for jp2 format. But R is not speaking to this one since the versions differ and this driver does not appear in the list I have in R.
What am I missing here ? how can I force R to use the right gdal version instead of the older one ?