Writes data to a temporary geospatial file and opens it in QGIS.

view_qgis(data, format = c("gpkg", "geojson"), layer = NULL, app = NULL)

Arguments

data

An object of class sf.

format

File format, either "gpkg" (default) or "geojson".

layer

Layer name for GeoPackage output. If NULL, inferred from the input expression or project name. Ignored for GeoJSON output.

app

QGIS application name or path. If NULL, resolved from configuration and standard macOS application directories.

Value

data, invisibly.

Details

This viewer is supported only on macOS. In a non-interactive session the input is validated and returned invisibly without writing a file or opening QGIS. Interactive files are written below ~/.misc and are not removed automatically. QGIS can be configured with MISC_QGIS_APP or options(misc.qgis_app = "QGIS-LTR").

See also

Examples

# \donttest{
if (interactive()) {
  sf::st_sf(
    id = 1,
    geometry = sf::st_sfc(sf::st_point(c(0, 0)))
  ) %>% view_qgis()
}
# }