Wednesday 7 June 2017

R plot raster with real colors


I'have a raster image from Scran25 IGN. In Qgis, it opens perfectly but in R (with rgdal or raster packages), I do not know how to keep the original colors like this exemple?


IGN scan25 from Banyuls


I have tried


library('rgdal')

library('raster')

scan25<-readGDAL("./Banyuls/MyCreate/etudehydoAOC/etudehydoAOC/Scan25/vrt_4communes.vrt")
communes<-readOGR(dsn = "./Banyuls//MyCreate/Surface_4communes/",layer = "4communesAOC")

scan25<-raster(scan25)
test<-aggregate(scan25,10,mean)

plot(communes)
plot(test,add=T)


And the result is IGN scan25 import in R with bad colors




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...