Skip to contents

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"))