st_sample with raster

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

st_sample with raster

R-sig-geo mailing list
Hi All,

Spatstat::rpoint has an argument f that accepts a pixel image object (class .im) to generate points based on the proportionate probability density of that raster.  Just wondering, does sf::st_sample or perhaps another function have a similar available method?

Thanks so much!
Ty

Tyler Frazier, Ph.D.
Lecturer of Interdisciplinary Studies
Data Science Program
College of William and Mary
Webpage: http://tjfrazier.people.wm.edu
Phone: +01 (757) 386-1269
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: st_sample with raster

edzer
sf::st_sample has a size argument, which can be specified as a vector to
operate per feature. If you give that a value equal to

st_area(obj) * obj$required_density

and maybe set exact = FALSE, you should get the densities you want.

On 7/30/19 12:25 AM, Tyler Frazier via R-sig-Geo wrote:

> Hi All,
>
> Spatstat::rpoint has an argument f that accepts a pixel image object (class .im) to generate points based on the proportionate probability density of that raster.  Just wondering, does sf::st_sample or perhaps another function have a similar available method?
>
> Thanks so much!
> Ty
>
> Tyler Frazier, Ph.D.
> Lecturer of Interdisciplinary Studies
> Data Science Program
> College of William and Mary
> Webpage: http://tjfrazier.people.wm.edu
> Phone: +01 (757) 386-1269
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

pEpkey.asc (2K) Download Attachment