knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

ggrasp

gg and R and sp

This is the "vector" version of tabularaster.

library(ggrasp)
library(tibble)
library(tidyr)
library(gris)
data(holy_poly)
spdata <- spbabel::sp(holy_poly, attr_tab = tibble(object_ = 1:3, mydat = c("a", "b", "c")))

x <- spdata
br <- gris(x)  ## gris

pr1 <- primitives1D(br) ## edges
pr2 <- primitives2D(pr1) ## triangles

Write analogy to gggeom to have doubly nested tables.

ggg <- nest(spdata)
plot(ggg, col = rainbow(nrow(ggg), alpha = 0.5))

Use this basis to build data+pslg version atts, 1D primitives, vertices (unique).

Decompose to just edges.

#edges <- primitives1D()

Use that to build 2D primitives.

Round trip from sp to branches to primitives to sp. Leverage sp/rgeos/rgdal for spatial ops, ggvis for visualization.



r-gris/ggrasp documentation built on May 26, 2019, 1:33 p.m.