geoaxe

knitr::opts_chunk$set(
  comment = "#>",
  collapse = TRUE,
  warning = FALSE,
  message = FALSE,
  fig.path = "man/figures/",
  fig.width = 5,
  fig.height = 4
)

knitr::opts_knit$set(global.device = TRUE)

cran checks Project Status: Active – The project has reached a stable, usable state and is being actively developed. R-CMD-check codecov.io rstudio mirror downloads cran version

geoaxe - split geospatial objects into pieces

Install

Stable CRAN version

install.packages("geoaxe")

Development version

pak::pkg_install("ropensci/geoaxe")
library("geoaxe")
library("sp")

Spatial Polygons and friends input

Works for only SpatialPolygons for now, but aim to include related classes soon.

library("rgeos")
wkt <- "POLYGON((-180 -20, -140 55, 10 0, -140 -60, -180 -20))"
poly <- rgeos::readWKT(wkt)
polys <- chop(x = poly)

Plot original polygon

plot(poly, lwd = 6)

Add chopped up polygon bits

plot(polys, add = TRUE)
dev.off()

Well-Known Text input

wkt <- "POLYGON((-180 -20, -140 55, 10 0, -140 -60, -180 -20))"
plot(chop(wkt))
dev.off()

Manipulate number of cells

plots go left to right, then down, and repeat

layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE))
par(mar = c(1, 0, 1, 0))
plot(chop(wkt, n = 10))
plot(chop(wkt, n = 15))
plot(chop(wkt, n = 20))
plot(chop(wkt, n = 50))
dev.off()

Manipulate cell size

plots go left to right, then down, and repeat

layout(matrix(1:8, 4, 2, byrow = TRUE))
par(mar = c(1, 0, 1, 0))
plot(chop(wkt, size = 2))
plot(chop(wkt, size = 4))
plot(chop(wkt, size = 8))
plot(chop(wkt, size = 15))
plot(chop(wkt, size = 25))
plot(chop(wkt, size = 50))
plot(chop(wkt, size = 100))
plot(chop(wkt, size = 200))
dev.off()

Meta



ropenscilabs/geoaxe documentation built on May 18, 2022, 7:38 p.m.