## function to split "label: text" into data.frame(label = text)
v1 <- function(x) {
x <- gsub(": ", ":", x) ## first clear that whitespace
dd <- read.delim(text = x, sep = ":", header = FALSE);
setNames(data.frame(dd[[2]]), dd[[1]][1])
}
library(sf)
sf::sf_use_s2(FALSE)
v <- read_sf("/vsizip/Google.Campus.zip/Google Campus.kml") ## vsizip is a GDAL feature so we don't have to unzip
dtext <- read.csv(text = gsub("<br>", ",", v$Description), header = F)
sfx <- st_sf(do.call(cbind, lapply(dtext, v1)), geometry = sf::st_geometry(v))
plot(sfx[0], col = sfx$HexCode)
text(sfx, labels = sfx$description)
Last active
January 23, 2025 14:44
-
-
Save mdsumner/1469b4ab53058e33bafc4fd9cda454eb to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment