Skip to content

Instantly share code, notes, and snippets.

@szechno
Created February 10, 2026 13:01
Show Gist options
  • Select an option

  • Save szechno/d2fa5740bf11e7fbbd024a8f5df8c24a to your computer and use it in GitHub Desktop.

Select an option

Save szechno/d2fa5740bf11e7fbbd024a8f5df8c24a to your computer and use it in GitHub Desktop.
# Improvements:
# add `mode` to get_routes by filtering available highway = *
# 'footway', 'unclassified','service', 'track', 'bridleway', 'path',
# 'residential', 'tertiary', 'primary', 'trunk', 'secondary', 'motorway',
# 'tertiary_link', 'pedestrian', 'cycleway', 'primary_link', 'motorway_link',
# 'trunk_link', 'secondary_link', 'living_street', 'construction', 'services',
# 'proposed', 'busway', 'crossing'
# mode == 'walking'
# not 'motorway', 'motorway_link', 'busway', 'cycleway', 'construction',
# 'services'
route_roads <- school_roads |> activate("edges") |> filter(highway %in% c(
'footway', 'unclassified','service', 'track', 'bridleway', 'path',
'residential', 'tertiary', 'primary', 'trunk', 'secondary',
'tertiary_link', 'pedestrian', 'primary_link', 'trunk_link', 'secondary_link',
'living_street', 'proposed', 'crossing'
))
# mode == 'cycling'
# not 'motorway', 'motorway_link', 'busway', 'construction', 'services'
route_roads <- school_roads |> activate("edges") |> filter(highway %in% c(
'footway', 'unclassified','service', 'track', 'bridleway', 'path',
'residential', 'tertiary', 'primary', 'trunk', 'secondary', 'tertiary_link',
'pedestrian', 'cycleway', 'primary_link', 'trunk_link', 'secondary_link',
'living_street', 'proposed', 'crossing'
))
# mode == 'car'
# 'footway', 'track', 'bridleway', 'path', 'pedestrian', 'cycleway', 'busway',
# 'crossing', 'construction'
route_roads <- school_roads |> activate("edges") |> filter(highway %in% c(
'unclassified','service', 'residential', 'tertiary', 'primary', 'trunk',
'secondary', 'motorway', 'tertiary_link', 'primary_link', 'motorway_link',
'trunk_link', 'secondary_link', 'living_street', 'services',
'proposed',
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment