[R-sig-Geo] Points to raster

Michael Sumner mdsumner at gmail.com
Thu Apr 12 16:37:20 CEST 2012


The sp and raster packages both have pathways for this.

library(sp)
coordinates(elev) <- c("x", "y")
gridded(elev) <- TRUE

See vignette("sp")

Or, using raster package:

library(raster)
r.elev <- rasterFromXYZ(elev)

In either case, if your coordinates aren't quite regular you'll need
to explore other options, like the 'tolerance' argument to
?SpatialPixelsDataFrame or the 'digits' argument to ?rasterFromXYZ.

Cheers, Mike.

On Fri, Apr 13, 2012 at 12:06 AM, Raphael Saldanha
<saldanha.plangeo at gmail.com> wrote:
> Hi!
>
> Which is the best way to convert a list of points to a raster? Bellow
> I have a excerpt from my 'elev' object.
>
>           x       y    elev
> 239937.9 7658988 407.079
> 239937.9 7658968 411.561
> 239937.9 7658948 415.924
> 239937.9 7658928 415.480
> 239937.9 7658908 414.896
> 239937.9 7658888 408.602
> 239937.9 7658868 402.261
> 239937.9 7658848 393.956
> 239937.9 7658828 385.692
> 239937.9 7658808 379.095
> 239937.9 7658788 372.509
>
>
> Thanks in advance,
>
> Raphael Saldanha
> saldanha.plangeo at gmail.com
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-sig-Geo mailing list