[R-sig-Geo] Values in a raster disappear when using reproject (plotKML, program = "GDAL")

Manuel Spínola mspinola10 at gmail.com
Sun Feb 21 18:13:13 CET 2016


Dear list members,

When reprojecting a raster using the function "reproject" from plotKML
using program GDAL I lost the values from the raster layer (I used this
option to speed up the process in comparison to projectRaster from the
Raster package). Is there a way to keep the values from the raster? The
raster is categorical, each value correspond to land cover type.

> ras = raster("lc.tif")
> ras
class       : RasterLayer
dimensions  : 16118, 21959, 353935162  (nrow, ncol, ncell)
resolution  : 98.4252, 98.4252  (x, y)
extent      : 183871.7, 2345191, 88600.88, 1675018  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5
+x_0=399999.9999999999 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=ft
+no_defs
data source :
C:\Users\Manuel\Documents\Documentos_personales\Clases_y_Cursos\Clases\ICOMVIS\03_Evaluacion_del_Habitat\Practicos\Practica_03_Seleccion_de_habitat_Paisaje\oregon\lc.tif
names       : lc
values      : 0, 95  (min, max)
attributes  :
       ID category
 from:  0    60051
 to  : 95  2481857


>rasp = reproject(ras, CRS("+proj=longlat +datum=WGS84"), program = "GDAL",
method = "nearest")
>rasp
class       : RasterLayer
dimensions  : 12941, 24966, 323085006  (nrow, ncol, ncell)
resolution  : 0.00034231, 0.00034231  (x, y)
extent      : -124.9617, -116.4156, 41.91483, 46.34466  (xmin, xmax, ymin,
ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
+towgs84=0,0,0
data source :
C:\Users\Manuel\AppData\Local\Temp\Rtmpkh9ze0\file14a81d003f19_ll.tif
names       : lc



Manuel



-- 
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspinola at una.ac.cr
mspinola10 at gmail.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list