ox_to_geojson: Export to GeoJSON

View source: R/io.R

ox_to_geojsonR Documentation

Export to GeoJSON

Description

Writes the graph's edges (or nodes) to a GeoJSON file via sf::st_write(). Geometry is transformed to EPSG:4326, the GeoJSON standard CRS.

Usage

ox_to_geojson(g, path, layer = c("edges", "nodes"))

Arguments

g

An osm_graph.

path

Output file path.

layer

Which layer to write: "edges" (default) or "nodes".

Value

path, invisibly.

Examples

g <- example_osm_graph()
ox_to_geojson(g, tempfile(fileext = ".geojson"))

osmnxr documentation built on Oct. 20, 2026, 1:07 a.m.