example_osm_graph: A small synthetic 'osm_graph' for examples and tests

View source: R/example.R

example_osm_graphR Documentation

A small synthetic osm_graph for examples and tests

Description

Builds a tiny ⁠n x n⁠ regular street grid as an osm_graph, with no network access. Edges are bidirectional and weighted by their planar length. Useful for examples, tests and learning the API offline.

Usage

example_osm_graph(n = 4, spacing = 100)

Arguments

n

Grid size; the network has n * n nodes. Default 4.

spacing

Distance between adjacent nodes, in CRS units. Default 100.

Value

An osm_graph in an arbitrary projected CRS.

Examples

g <- example_osm_graph()
g
ox_basic_stats(g)

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