[R-sig-Geo] Rasterize function

Michael Sumner mdsumner at gmail.com
Tue Apr 17 16:44:36 CEST 2018


On Wed, 18 Apr 2018 at 00:08 Jeri Wisman <jwism002 at odu.edu> wrote:

> Hi all -
>
> I am working on a code trying to "rasterize" spatial polygons created by
> kernelUD but somewhere in the code the values are getting lost and not
> translating when I created a raster dateframe and try to tie in the polygon
> lat/lon values into the raster frame. Attached is my code and data.
>

Hi, this is not really acceptable as a question to this list, because we
have to go through your script to figure out what you are referring to.

But, my guess is you want the "field" argument to ?rasterize:

> If x is a Spatial*DataFrame, this can be the column name of the variable
to be transferred. If missing, the attribute index is used (i.e.
> numbers from 1 to the number of features).

Your line

r.polys <- rasterize(shp, r)

will put the row number of shp into the appropriate pixel of r.polys, but
you might want to set

r.polys <- rasterize(shp, r, field = "somename")

where "somename" is a member of names(shp).

Just a guess.

Cheers, Mike



> Thanks!
> *Jeri Wisman* | Masters Candidate
> Old Dominion University
> Department of Biological Sciences
> Mills Godwin Building, Room 312
> Norfolk VA 23529 USA
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list