[R-sig-Geo] How to speed up the projection of a raster

Dominik Schneider Dominik.Schneider at colorado.edu
Fri Feb 19 16:59:46 CET 2016


Manual,
I generally find gdal directly (which is what's used by qgis) to be faster
than the raster package.  I would use either:
1. gdalUtils package which essentially just provides r-style syntax to the
gdal commandline utilities
2. use system() with the gdal commandline utility command given as a string
to this function.
I use os x so not sure if things are the same on windows, if that's your OS.
gl
ds


On Fri, Feb 19, 2016 at 8:08 AM, Manuel Spínola <mspinola10 at gmail.com>
wrote:

> Dear list members,
>
> I am trying to reproject a raster (see the code below), however the process
> is too slow.  What I need to do to speed up the process? It took me seconds
> to do the task in QGIS, but I prefer to do other raster projections in r.
>
> Thank you very much in advance.
>
> > ras = raster("lc.grd")
> > 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.grd
> names       : w001001
> values      : 0, 95  (min, max)
> attributes  :
>        ID   COUNT       RED     GREEN      BLUE
>  from:  0   60051 0.0000000 0.0000000 0.0000000
>  to  : 95 2481857 0.4392157 0.6392157 0.7294118
>                     LAND_COVER OPACITY
>                   Unclassified       1
>  Emergent Herbaceuous Wetlands       1
>
>
>
> > rasp = projectRaster(ras, crs = "+proj=longlat +datum=WGS84", method =
> "ngb")
>
> --
> *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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list