fishnet | R Documentation |
fishnet
Generate fishnet by the coordinatesGeneratue fishnet
fishnet
Generate fishnet by the coordinates
fishnet(xx, yy, crs = sp::CRS("+init=epsg:4326"), type = "polygon")
xx |
x coordinates |
yy |
y coordinates |
crs |
projections parameters, defaul = epsg:4326 |
type |
option = 'polygon', 'points', 'line' |
spatildata (.shp)
library(raster)
ext=c(0, 8, 2, 10)
dx = 2; dy = 4
xx=seq(ext[1], ext[2], by=dx)
yy=seq(ext[3], ext[4], by=dy)
sp1 =fishnet(xx=ext[1:2], yy=ext[3:4])
sp2 =fishnet(xx=xx + .5 * dx, yy=yy + 0.5 * dy)
sp3 =fishnet(xx=xx, yy=yy, type = 'point')
plot(sp1, axes=TRUE, xlim=c(-1, 1)*dx +ext[1:2], ylim=c(-1, 1)*dy + ext[3:4])
plot(sp2, axes=TRUE, add=TRUE, border=2)
plot(sp3, axes=TRUE, add=TRUE, col=3, pch=20)
grid()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.