Skip to content

Instantly share code, notes, and snippets.

@tim-salabim
Created January 15, 2019 09:46
Show Gist options
  • Select an option

  • Save tim-salabim/deaf9c0673800b240b21b82ed150239d to your computer and use it in GitHub Desktop.

Select an option

Save tim-salabim/deaf9c0673800b240b21b82ed150239d to your computer and use it in GitHub Desktop.
view polygon/line nodes
viewNodes = function(x, cex = 6) {
crds = sf::st_coordinates(x)[, c("X", "Y")]
n = nrow(crds)
pts = sf::st_as_sf(
data.frame(
id = 1:n,
x = crds[, "X"],
y = crds[, "Y"]
),
coords = c("x", "y"),
crs = sf::st_crs(x)
)
m = mapview::mapView(x)@map
leafgl::addGlPoints(m, pts, color = cbind(0, 0, 0),
opacity = 1, weight = cex, digits = 20)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment