get_osm download osm data from geofabrik. Instead of other services, this function relies only on direct links. Just that.

get_osm(region, type = "shp", file = tempfile(), quiet = FALSE)

Arguments

region

Region of interest, see urlgeo

type

"pbf", "shp" or "osm"

file

a character string (or vector, see url) with the name where the downloaded file is saved.

quiet

If TRUE, suppress status messages (if any), and the progress bar.

Value

Download a file

Note

all regions were transformed with iconv to "ASCII//TRANSLIT"

Examples

# \donttest{ head(urlgeo)
#> Region Subregion x LINKPBF size LINKSHP LINKOSM #> 1 Africa Algeria Algeria [.osm.pbf] (90MB) [.shp.zip] [.osm.bz2] #> 2 Africa Angola Angola [.osm.pbf] (51MB) [.shp.zip] [.osm.bz2] #> 3 Africa Benin Benin [.osm.pbf] (33.3MB) [.shp.zip] [.osm.bz2] #> 4 Africa Botswana Botswana [.osm.pbf] (60MB) [.shp.zip] [.osm.bz2] #> 5 Africa Burkina Faso Burkina Faso [.osm.pbf] (51MB) [.shp.zip] [.osm.bz2] #> 6 Africa Burundi Burundi [.osm.pbf] (27.3MB) [.shp.zip] [.osm.bz2] #> URL_OSMPBF #> 1 https://download.geofabrik.de/africa/algeria-latest.osm.pbf #> 2 https://download.geofabrik.de/africa/angola-latest.osm.pbf #> 3 https://download.geofabrik.de/africa/benin-latest.osm.pbf #> 4 https://download.geofabrik.de/africa/botswana-latest.osm.pbf #> 5 https://download.geofabrik.de/africa/burkina-faso-latest.osm.pbf #> 6 https://download.geofabrik.de/africa/burundi-latest.osm.pbf #> URL_SHP #> 1 https://download.geofabrik.de/africa/algeria-latest-free.shp.zip #> 2 https://download.geofabrik.de/africa/angola-latest-free.shp.zip #> 3 https://download.geofabrik.de/africa/benin-latest-free.shp.zip #> 4 https://download.geofabrik.de/africa/botswana-latest-free.shp.zip #> 5 https://download.geofabrik.de/africa/burkina-faso-latest-free.shp.zip #> 6 https://download.geofabrik.de/africa/burundi-latest-free.shp.zip #> URL_OSMBZ2 units sizeMB #> 1 https://download.geofabrik.de/africa/algeria-latest.osm.bz2 MB 90.0 #> 2 https://download.geofabrik.de/africa/angola-latest.osm.bz2 MB 51.0 #> 3 https://download.geofabrik.de/africa/benin-latest.osm.bz2 MB 33.3 #> 4 https://download.geofabrik.de/africa/botswana-latest.osm.bz2 MB 60.0 #> 5 https://download.geofabrik.de/africa/burkina-faso-latest.osm.bz2 MB 51.0 #> 6 https://download.geofabrik.de/africa/burundi-latest.osm.bz2 MB 27.3
get_osm("Sao Tome and Principe")
#> file at /tmp/Rtmpn0Zadc/file25c3276d81b6.shp.zip
get_osm("Sao Tome and Principe", "pbf")
#> file at /tmp/Rtmpn0Zadc/file25c3535f19af.osm.pbf
get_osm("Sao Tome and Principe", "osm")
#> file at /tmp/Rtmpn0Zadc/file25c33007fe2f.osm.bz2
# }