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

Modify types of railways that constitute rail_access #2

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

sgoel
Copy link
Collaborator

@sgoel sgoel commented Dec 17, 2024

This PR modifies the RailAccessParser to include and exclude the various OSM Railway types that we need to consider for the Remix rail routing product. See https://paper.dropbox.com/doc/Rail-routing-types-and-appearances--CcoTAuntwCvKSa99WV5edFPyAg-K1oQPVSL3s8eXf6SLyyow for more information about what we want to include and exclude.

After this change merges, the value of rail_access in the various custom costing profiles will change to include everything in the Set.

This addresses https://ridewithvia.atlassian.net/browse/REM-8628

A follow up PR will be needed in the monorepo to bust the cache on the curl request made to this repo in the dockerfile

@sgoel sgoel requested a review from davidmh December 17, 2024 22:46
Copy link
Member

@davidmh davidmh left a comment

Choose a reason for hiding this comment

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

Since we're now actively forking from upstream, we should look into updating the tests to cover our use-cases, then plug the test suite into the Github actions.

We should merge this as-is, I can start looking into the tests.

Copy link
Member

@davidmh davidmh left a comment

Choose a reason for hiding this comment

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

@sgoel
Copy link
Collaborator Author

sgoel commented Dec 18, 2024

Looking at the tests, are we sure that would be enough to allow the construction paths?

https://github.com/remix/OpenRailRouting/blob/b3e899bd07bcae6ca622e1631109a9aa2de633b9/src/test/java/de/geofabrik/railway_routing/parsers/OSMRailwayClassParserTest.java

I think for our use case, we don't need to worry about this at the moment unless Matthew is able to find a way that is tagged with service=*. See https://wiki.openstreetmap.org/wiki/Key:service#Railways. There's a really nice diagram on that page that describes the service=* options:
image

I can take a look at the test further, but in the import step, the code path that you linked to gets processed here: https://github.com/remix/OpenRailRouting/blob/master/src/main/java/de/geofabrik/railway_routing/RailImportRegistry.java#L81 and the code path that I have modified gets processed here: https://github.com/remix/OpenRailRouting/blob/master/src/main/java/de/geofabrik/railway_routing/RailImportRegistry.java#L120

@sgoel
Copy link
Collaborator Author

sgoel commented Dec 18, 2024

Related to our slack conversation about making the frontend configurable through the yaml file, I think I can refactor this work to again allow better customization through the yaml / json profiles instead of hard coding changes in the codebase.

@davidmh
Copy link
Member

davidmh commented Dec 18, 2024

The part I worry about is that the construction paths will still be lumped into the other value. But if you've tested that it doesn't that's fine.

@davidmh
Copy link
Member

davidmh commented Dec 18, 2024

Could you rebase against master to pick up the new setup? You may need to squash your commits into a valid message.

@sgoel sgoel force-pushed the rail-access-changes branch from 806546d to 242756f Compare December 18, 2024 18:48
@sgoel
Copy link
Collaborator Author

sgoel commented Dec 18, 2024

The part I worry about is that the construction paths will still be lumped into the other value. But if you've tested that it doesn't that's fine.

I think the reason that this is not an issue is that the all_tracks.json profile is only checking for !rail_access to disallow routing:

{
  "distance_influence": 0,
  "priority": [
    { "if": "!rail_access", "multiply_by": "0" }
  ],
  "speed": [
    { "if": "true", "limit_to": "rail_average_speed" }
  ]
}

Because of that, the parser that lumps construction ways in to OTHER has no affect.

@sgoel
Copy link
Collaborator Author

sgoel commented Dec 18, 2024

Could you rebase against master to pick up the new setup? You may need to squash your commits into a valid message.

done

@sgoel
Copy link
Collaborator Author

sgoel commented Dec 18, 2024

I spoke with @davidmh over tuple. It looks like we need to modify the RailwayClass.java file to mirror the changes in RailAccessParser.java so that we tag ways with more granularity rather than classifying them as RailwayClass.OTHER. This is necessary for styling the ways on the UI with the /mvt route.

@sgoel
Copy link
Collaborator Author

sgoel commented Dec 18, 2024

@davidmh let's hold off on merging this until I add a test for my changes

@davidmh
Copy link
Member

davidmh commented Dec 18, 2024

The commit I pushed should cover that, can you confirm?

@sgoel
Copy link
Collaborator Author

sgoel commented Dec 18, 2024

The commit I pushed should cover that, can you confirm?

It does. I'm going to add one for narrow_gauge as well

sgoel and others added 2 commits December 18, 2024 13:16
- add test for narrow gauge ways
- the ways that are allowed and disallowed are defined in the paper doc

https://paper.dropbox.com/doc/Rail-routing-types-and-appearances--CcscJphcnWQ4gQHZUZ7Gkcn7Ag-K1oQPVSL3s8eXf6SLyyow
We want to properly extract and categorize paths marked as construction,
instead of `other`, so we can set the corresponding style in the mvt
layer.
@davidmh davidmh force-pushed the rail-access-changes branch from 1b8f1cd to 416e7aa Compare December 18, 2024 21:18
@sgoel
Copy link
Collaborator Author

sgoel commented Dec 18, 2024

@davidmh I think this is ready to merge

@sgoel sgoel merged commit cd308fc into master Dec 18, 2024
1 check passed
@sgoel sgoel deleted the rail-access-changes branch December 18, 2024 21:32
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