download_osm | R Documentation |
Download Open Street Map shapefiles that correspond to 'roads', 'rivers' or any other natural feature and copy them to their corresponding folders.
download_osm(
mainPath,
location,
type,
alwaysDownload = FALSE,
mostRecent = TRUE,
defaultClasses = TRUE
)
mainPath |
character; the parent directory of the location folder |
location |
character; the location folder name |
type |
character; target layer. Can be 'roads', 'waterLines' or 'waterPolygons' |
alwaysDownload |
logical; should the shapefile always be downloaded, even if it has already been downloaded? If FALSE and if the shapefile has already been downloaded the user is interactively asked whether they want to download it again or not. |
mostRecent |
logical; should the most recent boundary shapefile be selected? If FALSE and if there are multiple available inputs, the user is interactively asked to select the input based on file creation time. |
defaultClasses |
logical; should only the default classes be kept? If not, the user is interactively asked to select the categories they want to keep. For 'roads', default classes are: trunk, trunk_link, primary, primary_link, motorway, motorway_link, secondary, secondary_link, tertiary, tertiary_link, road, raceway, residential, living_street, service, track, pedestrian, path, footway, piste, bridleway, cycleway, steps, unclassified and bridge. For waterLines and waterPolygons, default classes are river and water, respectively. |
# Replace workDir with the actual path to your working directory
## Not run:
mainPath <- "workDir"
initiate_project(mainPath)
## End(Not run)
# Replace myLocation with the location name you are working on (workDir subfolder)
## Not run:
location <- "myLocation"
download_osm(mainPath, location, type = "roads", alwaysDownload = TRUE, mostRecent = NULL, defaultClasses = TRUE)
download_osm(mainPath, location, type = "waterLines", alwaysDownload = TRUE, mostRecent = NULL, defaultClasses = TRUE)
download_osm(mainPath, location, type = "waterPolygons", alwaysDownload = TRUE, mostRecent = NULL, defaultClasses = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.