# Script to generate folders that will contain images, one for each urban area.
# Script should only be needed to run once.

urban_areas <- readOGR("shapefiles", "urban_simpl")
urban_areas$SUA_NAME11 <- sub(" \\-.*", "", urban_areas$SUA_NAME11)

urban_areas <- urban_areas[-grep(pattern="Not in any", urban_areas$SUA_NAME11), ]

for(urban_area in urban_areas$SUA_NAME11) {
  # Uncomment the shell calls to actually make the folders.
  
  shell_str <- sprintf("mkdir shapefiles\\ubran_areas\\\"%s\"", urban_area)
  shell(shell_str)
}
