添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Sun Jun 23 22:08:17 CEST 2013
  • Previous message: [R-sig-Geo] Problem with NDVI difference with subset image
  • Next message: [R-sig-Geo] Problem with NDVI difference with subset image
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] I work in OS linux and I like very much your lssub function, despites your notice. I think that the problems are in linux system, because: > landc<- stack(c("stackIm1.sample.tif","tackIm2.sample.tif")) Error in .local(.Object, ...) : `/home/asantos/Documentos/Sensoriamento remoto percevejo bronzeador/Contornos/tackIm2.sample.tif' does not exist in the file system, and is not recognised as a supported dataset name. Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", : Cannot create a RasterLayer object from this file. (file does not exist) When I try to look the geotiff created (stackIm1.sample.tif) there are something wrong, because the pictures doesn't open (complete example below). Thanks for your attention, Alexandre require(raster) require(sp) require(rgdal) require(landsat) #Create raster r <- raster(nc=1000, nr=1000) set.seed(20130622) stackIm1 <- stack(lapply(1, function(x) setValues(r, round(runif(ncell(r))* 255))))## Simulation red band stackIm2 <- stack(lapply(1, function(x) setValues(r, round(runif(ncell(r))* 255))))## Simulation nir # define projection system r.geo <- CRS("+proj=utm +zone=23 +south +datum=WGS84 +units=m +no_defs") # geographical datum WGS84 proj4string(stackIm1) <- r.geo proj4string(stackIm2) <- r.geo #Create geotiff writeRaster(stackIm1, filename="stackIm1.tif", format="GTiff",overwrite=TRUE) writeRaster(stackIm2, filename="stackIm2.tif", format="GTiff",overwrite=TRUE) #Subset a geotiff image 50 x 50 pixels stackIm1.sample<-lssub("stackIm1.tif", "stackIm1.sample.tif", centerx = 0, centery = 0, widthx = 50, widthy = 50) stackIm2.sample<-lssub("stackIm1.tif", "sstackIm2.sample.tif", centerx = 0, centery = 0, widthx = 50, widthy = 50) landc<- stack(c("stackIm1.sample.tif","tackIm2.sample.tif")) > What is your sessionInfo()? > As it says in the lssub() help, this function was written for a > particular purpose, is only known to work on linux, and may not be > widely applicable. > It's a "use at your own risk" kind of function, and you may well be > better off using one of the many other methods available for > subsetting raster data, which would save you the whole "export as > GeoTIFF, subset, reimport" sequence. > Sarah > On Sun, Jun 23, 2013 at 11:36 AM, Alexandre Santos > < alexandresantosbr at yahoo.com.br > wrote: >> Dear Members, >> I'm having trouble calculating NDVI difference, first the images Geotiff can not view using Ubuntu 4.12 64-bit and therefore can not get to the NDVI, follow an example: >> require(raster) >> require(sp) >> require(rgdal) >> require(landsat) >> #Create raster >> r <- raster(nc=1000, nr=1000) >> set.seed(20130622) >> stackIm1 <- stack(lapply(1, function(x) setValues(r, round(runif(ncell(r))* 255))))## Simulation red band >> stackIm2 <- stack(lapply(1, function(x) setValues(r, round(runif(ncell(r))* 255))))## Simulation nir >> # define projection system >> r.geo <- CRS("+proj=utm +zone=23 +south +datum=WGS84 +units=m +no_defs") # geographical datum WGS84 >> proj4string(stackIm1) <- r.geo >> proj4string(stackIm2) <- r.geo >> #Create geotiff >> writeRaster(stackIm1, filename="stackIm1.tif", format="GTiff",overwrite=TRUE) >> writeRaster(stackIm2, filename="stackIm2.tif", format="GTiff",overwrite=TRUE) >> #Subset a geotiff image 50 x 50 pixels >> stackIm1.sample<-lssub("stackIm1.tif", "stackIm1.sample.tif", centerx = 0, centery = 0, widthx = 50, widthy = 50) >> stackIm2.sample<-lssub("stackIm1.tif", "sstackIm2.sample.tif", centerx = 0, centery = 0, widthx = 50, widthy = 50) >> #Calculate NDVI difference >> multi.espc<-stack(c("stackIm1.sample.tif","stackIm2.sample.tif")) >> band3<-raster(multi.espc,1) >> band4<-raster(multi.espc,2) >> ndvi<-(band4-band3)/(band4+band3) ====================================================================== Alexandre dos Santos Proteção Florestal Coordenador do curso Técnico em Florestas Vice Coordenador do curso de Engenharia Florestal IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso Campus Cáceres Caixa Postal 244 Avenida dos Ramires, s/n Bairro: Distrito Industrial Cáceres - MT CEP: 78.200-000 Fone: (+55) 65 8132-8112 (TIM) (+55) 65 9686-6970 (VIVO) alexandre.santos at cas.ifmt.edu.br
  • Previous message: [R-sig-Geo] Problem with NDVI difference with subset image
  • Next message: [R-sig-Geo] Problem with NDVI difference with subset image
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
  •