ox_download: Download OSM export

View source: R/ox_download.R

ox_downloadR Documentation

Download OSM export

Description

Download an OSM export by specifying its bounding box, or find a local cached equivalent. The osmxml package does not further make use of the OSM API, given that it is mainly intended to be used for editing purposes, as explained on the API Usage Policy website: https://operations.osmfoundation.org/policies/api/. This function only mimics the existing https://www.openstreetmap.org "Export" functionality to save the user manually downloading the file from the website.

Usage

ox_download(bbox, destfile = NULL, use_cached = TRUE)

Arguments

bbox

bounding box of area to download, determined by a numeric vector of four values: Western longitude, Southern latitude, Eastern longitude, Northern latitude (in this order)

destfile

path to download the file to. Defaults to a filename that includes the bbox values so it can be used as cached data (in the current working directory).

use_cached

should the function look for a matching cached file? Logical, default is TRUE.

Value

The path is returned so it can easily be piped into the ox_read function

Licence

All data downloaded with this function is © OpenStreetMap contributors, and the conditions of its reuse are defined by the ODbL licence. You likely need to include this information on anything derived from it. Find out more on the OSM website: https://www.openstreetmap.org/copyright

Examples

## Not run: 
# Download and read area around Te Kura Tatauranga, Waipapa Taumata Rau
TKT <- c(174.76598, -36.85440, 174.77019, -36.85129) |>
   ox_download() |>
   ox_read()

## End(Not run)

stragu/osmexport documentation built on Aug. 7, 2022, 12:07 a.m.