Skip to content
Prev 3977 / 7420 Next

create point grid within polygon

On 07/23/2013 07:29 PM, David Garc?a Callejas wrote:
Hi David,

Have a look to:

?sp::spsample

--------- START example--------
library(sp)

# irregular polygon
data(meuse.riv)
meuse.sr = SpatialPolygons(list(Polygons(list(Polygon(meuse.riv)), "x")))

# points within polygon
mypoints <- spsample(meuse.sr, n = 00, "regular")

class(mypoints)
#"SpatialPoints"


# Plotting
plot(meuse.sr)
points(mypoints, pch = 3)
--------- END example--------

IHTH,

Mauricio Zambrano-Bigiarini, Ph.D