Skip to content

Instantly share code, notes, and snippets.

@jwass
Created March 20, 2015 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwass/ea3ef0f96858e8f6b174 to your computer and use it in GitHub Desktop.
Save jwass/ea3ef0f96858e8f6b174 to your computer and use it in GitHub Desktop.
Quick thoughts on representing a road network in JSON. Basically TopoJSON for OSM nodes/ways.
{
"type": "network",
"nodes": [
{"coordinates": [-71.13568, 42.38196], "properties": {}},
{"coordinates": [-71.13555, 42.382523], "properties": {"highway": "traffic_signals"}},
{"coordinates": [-71.134087, 42.38384], "properties": {"railway": "level_crossing"}},
{"coordinates": [-71.141007, 42.386862], "properties": {"highway": "crossing"}}
],
"geometries": [
{"type": "LineString", "nodes": [0, 1, 2], "properties": {"highway": "primary", "name": "Main Street"}},
{"type": "LineString", "nodes": [2, 3], "properties": {"highway": "motorway_link"}}
]
}
@jwass
Copy link
Author

jwass commented Mar 20, 2015

It's not much different from just GeoJSON with points and lines, but finding intersections would be an explicit integer (or maybe some ID) comparison rather than doing the floating point match on the coordinates. And modifications to any coordinates update all references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment