R/osm.R

Defines functions osm

Documented in osm

osm <- function(country, var, path, proxy=FALSE, ...) {
	stopifnot(var %in% c("places", "highways", "railway"))
	iso <- .getCountryISO(country)
	path <- .get_path(path, "osm")

	filename <- paste0(iso, "_", var, ".gpkg")
	filepath <- file.path(path, filename)

	if (!(file.exists(filepath))) {
		url <- .data_url(paste0("osm/", var, "/", filename))
		if (is.null(url)) return(NULL)
		if (!.downloadDirect(url, filepath, ...)) return(NULL)
	} 
	vect(filepath, proxy=proxy)
}

	

Try the geodata package in your browser

Any scripts or data that you put into this service are public.

geodata documentation built on June 22, 2024, 10:30 a.m.