Skip to content

Instantly share code, notes, and snippets.

@lbusett
Created February 19, 2020 13:57
Show Gist options
  • Save lbusett/b3a300add9f00384140df11e294fc8f1 to your computer and use it in GitHub Desktop.
Save lbusett/b3a300add9f00384140df11e294fc8f1 to your computer and use it in GitHub Desktop.
scrip_convert_kml
#install.packages("gdalUtilities")
library(gdalUtilities)
in_folder <- "/home/lb/nr_data/fire_cci/reference/Africa/Landsat8/Luini/178066/kml_lorenzo/"
out_folder <- file.path(in_folder, "shape_conversion")
dir.create(out_folder)
kml_files <- list.files(in_folder, pattern = "kml$", full.names = TRUE)
for(ff in kml_files) {
print(ff)
out_file <- file.path(out_folder,
paste0(tools::file_path_sans_ext(basename(ff)), ".shp"))
if (!file.exists(out_file)) {
gdalUtilities::ogr2ogr(ff, out_file)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment