Displays the content of an OSM file either in .html, .xml or .opl format.

show_content(
  input_path,
  output_format = c("html", "opl", "xml"),
  object_type = c("all", "node", "way", "relation", "changeset"),
  echo_cmd = FALSE,
  spinner = TRUE,
  preview = TRUE
)

Arguments

input_path

A string. The path to the OSM file whose content should be shown. Please see file_formats for a list of supported file formats.

output_format

A string. The format in which the content should be shown. Either "html", "opl" or "xml". Please note that the "html" option, although the most human readable format, results in large files that may be very slow to open and inspect, depending on the size of the input file.

object_type

A character vector. The object types that should be included in the output. Please note that using "all" is a simple way of passing all other available types ("node", "way", "relation" and "changeset").

echo_cmd

A logical. Whether to print the Osmium command generated by the function call to the screen. Defaults to FALSE.

spinner

A logical. Whether to show a reassuring spinner while the Osmium call is being executed. Defaults to TRUE.

preview

A logical. Whether to open the temporary file in which the content of the OSM file was saved.

Value

The path to the temporary file in which the OSM file content was saved.

Examples

pbf_path <- system.file("extdata/cur.osm.pbf", package = "rosmium")

small_pbf <- tags_filter(
  pbf_path,
  "note",
  tempfile(fileext = "osm.pbf"),
  omit_referenced = TRUE
)

# both function calls below result in outputs with the same object types

show_content(small_pbf, object_type = "all")
#> [1] "/tmp/Rtmp5CH32i/osm_content34213a2daf7b.html"
show_content(
  small_pbf,
  object_type = c("node", "way", "relation", "changeset")
)
#> [1] "/tmp/Rtmp5CH32i/osm_content34212a5d2ccb.html"

# only show nodes and ways

show_content(small_pbf, object_type = c("node", "way"))
#> [1] "/tmp/Rtmp5CH32i/osm_content34214766de18.html"

# display all objects in xml format

show_content(small_pbf, output_format = "xml")
#> [1] "/tmp/Rtmp5CH32i/osm_content34215228345f.xml"