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

[FEATURE] Subway lines (with offsets) #555

Open
nvkelso opened this issue Apr 19, 2023 · 10 comments
Open

[FEATURE] Subway lines (with offsets) #555

nvkelso opened this issue Apr 19, 2023 · 10 comments
Labels
help wanted I don't plan to work on this but can advise anyone else who wants to pick it up

Comments

@nvkelso
Copy link

nvkelso commented Apr 19, 2023

Is your feature request related to a problem? Please describe.

When designing a transit map it's ideal to have subway lines (and sometimes other lines like light rail) considered as a group along a way but offset from each other for visual display, by zoom. Right now the lines stack on top of each other (because that's how the OSM data comes in) instead of being offset for visual display per zoom.

Describe the solution you'd like

The older Maps.ME open source project has a good tool for generating offset transit lines:
https://github.com/mapsme/omim/blob/master/docs/SUBWAY_GENERATION.md
and
https://github.com/mapsme/subways

The downside of this tool is it had to be run per city instead of globally. (When running globally such algos can get greedy.) Ideally this can be run globally (or for whatever bbox and planet extract is input), though.

Describe alternatives you've considered

n/a

Additional context

Here's what this looks like in San Francisco, California in Organic Maps (a free continuation of original FOSS Maps.Me codebase):

NOTE: In this case station "pills" look like they are also being generated, which is something that MapboxGL to my knowledge doesn't know how to generate. However, you could probably trick it by calculating width and angle for each station node across the offset lines?

image

@bdon
Copy link
Contributor

bdon commented Apr 20, 2023

Do we want to use OSM as a datasource or something like aggregated GTFS via transitland?

https://www.transit.land/map#10.76/52.5183/13.3067

@msbarry
Copy link
Contributor

msbarry commented Apr 21, 2023

So in this case what do you think we would have to do ahead of time vs what could the client do at render time? It seems like at one extreme we could have planetiler place the stylized subway lines at fixed points on the ground, or the other we could have planetiler pass along an "offset index" or something to maplibre to use with its line-offset property - although that doesn't handle splits/joins/turns/station angles ...

@nvkelso
Copy link
Author

nvkelso commented Apr 22, 2023

If you want smoothly interpolated line offsets between tile integer zooms, you need to include lines & their offsets as metadata on a single "railway" geometry feature. As you point out MapLibre / MapboxGL only kinda know how to render this properly (splits/joins/turns/station angles), though.

The poor man's version (so each line get's its own offset geometry feature) would probably render more reliably in current off the shelf graphics software.

@nvkelso
Copy link
Author

nvkelso commented Apr 22, 2023

Do we want to use OSM as a datasource or something like aggregated GTFS via transitland?

I'm a big fan of Transitland.

But most the subway (and railway) information is already in OpenStreetMap... so I'd start with OSM first.

The nice thing about OSM is it already includes the geometry, and the relations. While GTFS doesn't require sending down the geometries so you often have to backfill them.

@wipfli
Copy link
Contributor

wipfli commented Jun 26, 2023

Screenshot_20230626-151439
https://www.sbb.ch/de/freizeit-ferien/destinationen/staedte-laender-europa.html

@1ec5
Copy link

1ec5 commented Sep 9, 2024

Possibly of interest: the QLever team has demonstrated generating transit overlays using SPARQL queries on QLever and various postprocessing steps that would definitely be more appropriate to Planetiler than anything on the client side.

@msbarry msbarry added the help wanted I don't plan to work on this but can advise anyone else who wants to pick it up label Sep 9, 2024
@msbarry
Copy link
Contributor

msbarry commented Sep 12, 2024

Cool - looks like there's an online demo here: https://loom.cs.uni-freiburg.de/global#subway-lightrail/geo/15/48.782366709946764/9.185643196105959

The transit tiles are served as mvt's, here's an example: https://gist.github.com/msbarry/6d7c306b137d0f37ace20b68671c693f

image

So it looks like they actually render lines and stations at pixel locations in the tile that change by zoom level. IMO that's a very "raster" way to do it that will lead to the results jumping every time you scroll into a new zoom level instead of the smooth transitions you expect from vector tiles.

I'm wondering if there are better ways to encode this data in vector tiles that let the client smoothly render these without needing to fall back to this raster-like approach?

@1ec5
Copy link

1ec5 commented Sep 12, 2024

The colored lines can swap places as you zoom in, which would get even more confusing if it somehow supported incremental zoom. I wonder if this is a fundamental constraint of this kind of cartographic treatment though.

@msbarry
Copy link
Contributor

msbarry commented Sep 13, 2024

Apple maps seems to make this work for vector maps. The lines appear to follow their geographic coordinates, but when you zoom out far enough that they would overlap they keep a minimum pixel offset so that they don't overlap. It's almost like they "collapse carriageways" but retain an offset and the client knows how to render a line with a minimum pixel offset to either side. The order of lines can switch when you zoom in, but that's the only abrupt change I notice. I think something like that would need some kind of new support in maplibre

@nvkelso
Copy link
Author

nvkelso commented Sep 13, 2024

Yes, good sleuthing! It's definitely the more "correct" solution but requires complex render support. So a 80% solution that's workable with existing tools would be valuable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted I don't plan to work on this but can advise anyone else who wants to pick it up
Projects
None yet
Development

No branches or pull requests

5 participants