[R-sig-Geo] How to make a raster from a shapefile

Robert J. Hijmans r.hijmans at gmail.com
Sat Oct 30 01:54:53 CEST 2010


Manuel,

You can use overlay methods in sp or, in raster, one of:
linesToRaster, polygonsToRaster, or pointsToRaster.

This:

cob = raster(cobertura)

returns an 'empty' raster with the same extent as cobertura.

Robert


On Fri, Oct 29, 2010 at 4:18 PM, Manuel Spínola <mspinola10 at gmail.com> wrote:
> Dear list members,
>
> How I make a raster file from a shapefile?
>
> I tried this, but I don't think is right.  Also, I lost the projection in
> the raster "cob", why?
>
>> cob = raster(cobertura) # cobertura is a shapefile
>> plot(cob)
> Error en .plotraster(x, col = col, maxpixels = maxpixels, ...) :
>  no values associated with this RasterLayer
>
> Best,
>
> Manuel
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list