Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sub network/schedule #103

Merged
merged 13 commits into from
Dec 17, 2021
Merged

Sub network/schedule #103

merged 13 commits into from
Dec 17, 2021

Conversation

KasiaKoz
Copy link
Collaborator

@KasiaKoz KasiaKoz commented Dec 2, 2021

Methods to return a new Network or Schedule object subsetted using link IDs and service IDs.

  • Includes a convenience method for spatial subsetting.
  • Ensures the network links for services given are retained in the Network and that the resulting graph is strongly connected for the routable agent modes.

@KasiaKoz KasiaKoz requested review from gac55 and ana-kop December 2, 2021 16:44
Copy link
Contributor

@gac55 gac55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@@ -420,6 +420,10 @@ def links_on_spatial_condition(self, region_input, how='intersect'):
the tokens string copied using http://s2.sidewalklabs.com/regioncoverer/
e.g. '89c25985,89c25987,89c2598c,89c25994,89c25999ffc,89c2599b,89c259ec,89c259f4,89c25a1c,89c25a24'
- shapely.geometry object, e.g. Polygon or a shapely.geometry.GeometryCollection of such objects
:param how:
- 'intersect' default, will return IDs of the Services whose at least one Stop intersects the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I can see use cases for both types selection

"""
logging.info('Subsetting a Network will likely result in a disconnected network graph. A cleaner will be ran '
'that will remove links to make the resulting Network strongly connected for modes: '
'car, walk, bike.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be parametrised for future compatibility? Perhaps not, as car, walk, bike is fairly standard and I can't think of any non PT modes we may introduce in the future. I suppose networks for scooters etc is technically possible.

Subset a Network object using a spatial bound
:param region_input:
- path to a geojson file, can have multiple features
- string with comma separated hex tokens of Google's S2 geometry, a region can be covered with cells and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely to see so many options. I imagine geojson will be v common, but S2 support is 🆒

@KasiaKoz KasiaKoz merged commit 24bfbee into master Dec 17, 2021
@KasiaKoz KasiaKoz deleted the sub-network branch December 17, 2021 16:14
@KasiaKoz KasiaKoz mentioned this pull request Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants