Repository navigation
examples: London route notebook, roads notebook and examples README - #61
Merged
Merged
Conversation
The roads.py example as a notebook, with its comments as markdown cells and its output (verbose search, path, plot) included. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A notebook that builds a DGraph from an OpenStreetMap extract of central London (junctions as vertices, one edge per driving direction, costs along the shape of the road), keeps the strongly connected part, and plans routes between landmarks with A*, there and back. osm.py holds the OpenStreetMap-specific parts (the Overpass request, which ways a car may use, their direction, a JSON cache); london.json is the cached extract, (c) OpenStreetMap contributors, ODbL. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
local_projection(lat0, lon0) returns project(lat, lon): the transverse Mercator on the WGS84 ellipsoid centred on the map, by Krueger's series to fourth order. It agrees with PROJ to 3 nm over the box. The equirectangular scaling that it replaces was out by up to 9 m, and the routes by 15 m. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
osm.py writes the cache with one way or node per line, ways before nodes, so a re-fetch is a few changed lines in a diff and a reader sees the ways first. london.json is the area fetched on 2026-10-13, in that layout. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Which nodes become vertices, with the arms table; the ways by direction in an ansitable table; the shape of an edge; plot() against the edge shapes, pruned to a region; the nodes called vertices throughout. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 43 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61 +/- ##
=======================================
Coverage 97.18% 97.18%
=======================================
Files 3 3
Lines 1562 1562
=======================================
Hits 1518 1518
Misses 44 44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two Jupyter notebooks and the examples README.
examples/london.ipynb, withosm.pyandlondon.jsonA real-world example: the road network of central London from OpenStreetMap as a directed, embedded
DGraph, and the shortest drive between Buckingham Palace and Tower Bridge, there and back (the routes differ because of one-way streets). It showslocal_projection, checked against PROJ to 3 nm over the area; the simple scaling it replaces is out by up to 9 m),Edgesubclass that carries the street name and the shape of the road, and parallel edges for roads that join the same vertices,plot()is the wrong tool for a map, against the saved edge shapes, in a region pruned from the graph,closest, A* and breadth-first search, there and back.osm.pyhas the OpenStreetMap-specific parts (the Overpass request and its requiredUser-Agent, which ways a car may use and in which direction, the cache) and needs only the standard library and numpy.london.jsonis the area saved from OpenStreetMap, one way or node per line, ways first, so a re-fetch is a few changed lines in a diff. The notebook reads it, so it runs offline.Map data © OpenStreetMap contributors, Open Database License; the notebook,
osm.pyand the README say so, and the file's ownsourceentry.examples/roads.ipynbThe Queensland example as a notebook, with its comments as markdown cells.
examples/README.mdDescribes both examples and the benchmark.
No source changes. The notebooks were executed and their stored outputs match a fresh run.
🤖 Generated with Claude Code