om_get: Get map layers

View source: R/om_get.R

om_getR Documentation

Get map layers

Description

Download various OpenStreetMap features to create map layers.

Usage

om_get(
  x,
  r,
  download_directory = tempdir(),
  force_download = FALSE,
  max_file_size = 20,
  force_building = FALSE,
  quiet = FALSE
)

Arguments

x

an sf or sfc object, or a couple of coordinates (lon/lat, EPSG:4326)

r

radius of the extraction if x is an sf POINT or a couple of coordinates

download_directory

directory to store the file containing raw OpenStreetMap data

force_download

if TRUE, the OpenSteetMap file is updated even if it has already been downloaded.

max_file_size

the maximum file size to download without asking in interactive mode, in megabytes (default to 20 MB)

force_building

force the extraction of buildings in zones larger than 20 km²

quiet

if FALSE, the function prints informative messages

Value

A list of map layers is returned :

  • zone, the extraction zone;

  • urban, urban areas;

  • building, buildings (if the extraction zone area is below 20 km² or force_building = TRUE);

  • green, green spaces;

  • road, main roads;

  • street, secondary roads;

  • railway, railways (line);

  • water, water bodies

If x uses an unprojected CRS (lon/lat, EPSG:4326), ouput uses Web Mercator CRS (EPSG:3857), it uses x CRS otherwise.

Examples

res = om_get(c(-61.070, 14.605), r = 600)
om_map(res, title = "Fort-de-France town centre")

maposm documentation built on Sept. 17, 2026, 5:08 p.m.