Skip to content

Instantly share code, notes, and snippets.

@KarthiAru
Created December 19, 2016 12:45
Show Gist options
  • Save KarthiAru/d3dc2e31ebcd4df3f3abf6650e42c616 to your computer and use it in GitHub Desktop.
Save KarthiAru/d3dc2e31ebcd4df3f3abf6650e42c616 to your computer and use it in GitHub Desktop.
# Get the layers from .kml file
layers <- ogrListLayers('bbmp.kml')
# Import layers to a list
timer_all <- Sys.time()
pb <- txtProgressBar(max=length(layers), style = 3)
options(warn=-1) # disable warnings
poly.data <- list()
for (i in 1:length(layers)) {
poly.data[i] <- readOGR(dsn="bbmp.kml", layer=layers[i], encoding="utf-8", verbose = F)
}
cat("***Process completed in",round(difftime(Sys.time(), timer_all, tz = "", units = "mins"),2),"min!***")
options(warn = 0) # re-enable warnings
close(pb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment