onthegomap / planetiler

Flexible tool to build planet-scale vector tilesets from OpenStreetMap data fast
Apache License 2.0
1.22k stars 101 forks source link

[FEATURE] Subway lines (with offsets) #555

Open nvkelso opened 1 year ago

nvkelso commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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