ox_read: Read OSM data

View source: R/ox_read.R

ox_readR Documentation

Read OSM data

Description

Read OSM XML files, sometimes obtained from the "Export" page on openstreetmap.org. Internally, uses the sf::st_read() function, which itself use GDAL's OSM driver: https://gdal.org/drivers/vector/osm.html

Usage

ox_read(path, expand_tags = TRUE)

Arguments

path

Path to .osm file (string)

expand_tags

Should the "other_tags" column be expanded into single-tag columns? (logical; default is TRUE)

Value

An object of class "osm". There are print and plot methods for this class.

According to GDAL, the object is made of:

  • points: “node” features that have significant tags attached

  • lines: “way” features that are not recognised as areas

  • multilinestrings: “relation” features that form a multilinestring (type = ‘multilinestring’ or type = ‘route’)

  • multipolygons: “relation” features that form a multipolygon (type = ‘multipolygon’ or type = ‘boundary’), and “way” features that are recognised as areas

  • other_relations: “relation” features that do not belong to either multilinestrings or multipolygons

Examples

# read example South Brisbane .osm file
sb <- ox_read(
  system.file("extdata/south_brisbane.osm",
              package = "osmxml"),
  expand_tags = FALSE)

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