[R-sig-Geo] raster::ratify and as.factor Error in 1:ncol(r) : argument of length with raster read from large tif

Robert J. Hijmans r.hijmans at gmail.com
Sun Aug 31 20:51:40 CEST 2014


Nevil,
Thanks for reporting and including an example file. The error occurs
when showing a RasterLayer with a RAT table that only has IDs (but no
attributes for these IDs). Did it otherwise affect anything? Either
way, this has been fixed for the next version.
Robert

On Mon, Jul 7, 2014 at 6:52 AM, nevil amos <nevil.amos at gmail.com> wrote:
> I have encountered the following error , and not that it was previously
> raised: https://stat.ethz.ch/pipermail/r-help/2013-December/364489.html
> but I cannot find any solution.
>
> I have now encountered this issue a number of times with various large tif
> files  exported form ARCGIS.
>
> Can anyone suggest a solution?
>
> I cannot include w worked example since the functions work OK with rasters
> created within R ( and many imported ones too).
>
> I have put a zipped copy of the tif file ( and its associated vat file ovr
> file etc) on the web at
> :https://www.dropbox.com/s/oqur9m5lpt9menx/EFG_PLMGEN_FIREHAT2014_VG94100.zip
>
> Thanks
>
>
>> sessionInfo()
> R version 3.1.0 (2014-04-10)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252
> LC_MONETARY=English_Australia.1252
> [4] LC_NUMERIC=C                       LC_TIME=English_Australia.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] rgdal_0.8-16  raster_2.2-31 sp_1.0-14
>
> loaded via a namespace (and not attached):
> [1] grid_3.1.0      lattice_0.20-29 tools_3.1.0
>>
>> R<-raster("C:/Users/JNA/Documents/GIS/GrowthStage_TFI_Status/EFG_PLMGEN_FIREHAT2014_VG94100.tif")
>> ratify(R)
> class       : RasterLayer
> dimensions  : 5676, 8129, 46140204  (nrow, ncol, ncell)
> resolution  : 100, 100  (x, y)
> extent      : 2126760, 2939660, 2259503, 2827103  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=lcc +lat_1=-36 +lat_2=-38 +lat_0=-37 +lon_0=145
> +x_0=2500000 +y_0=2500000 +ellps=GRS80 +units=m +no_defs
> data source :
> C:\Users\JNA\Documents\GIS\GrowthStage_TFI_Status\EFG_PLMGEN_FIREHAT2014_VG94100.tif
> names       : EFG_PLMGEN_FIREHAT2014_VG94100
> values      : 0, 56660  (min, max)
> attributes  :
> Error in 1:ncol(r) : argument of length 0
>> as.factor(R)
> class       : RasterLayer
> dimensions  : 5676, 8129, 46140204  (nrow, ncol, ncell)
> resolution  : 100, 100  (x, y)
> extent      : 2126760, 2939660, 2259503, 2827103  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=lcc +lat_1=-36 +lat_2=-38 +lat_0=-37 +lon_0=145
> +x_0=2500000 +y_0=2500000 +ellps=GRS80 +units=m +no_defs
> data source :
> C:\Users\JNA\Documents\GIS\GrowthStage_TFI_Status\EFG_PLMGEN_FIREHAT2014_VG94100.tif
> names       : EFG_PLMGEN_FIREHAT2014_VG94100
> values      : 0, 56660  (min, max)
> attributes  :
> Error in 1:ncol(r) : argument of length 0



More information about the R-sig-Geo mailing list