tilezen / vector-datasource

Tilezen vector tile service - OpenStreetMap data in several formats
https://www.nextzen.org/
Other
509 stars 120 forks source link

Calculate line offset for transit route relations #1189

Open nvkelso opened 7 years ago

nvkelso commented 7 years ago

Description from forward dup:

I see:

screen shot 2016-09-19 at 13 41 14

I want to see: system-map

Original description:

In San Francisco, New York, London, Paris, Tokyo, and other important transit markets multiple transit "lines" travel along the same "tracks".

Right now in the transit layer we export duplicative features per relation, and in the roads layer we have just the track geometry. To offset the lines client-side in Tangram we'd need a single geometry per track part (like in the roads layer), with an ordered list of relations that hang off that geometry.

To allow the Tangram team to prototype I propose we hang an ordered list of transit "lines" (relations) off the roads layer geometry with just the line name, color and optionally operator, line shield text (ref), and transit mode (e.g. subway, light rail, rail).

Update: All we need here is a relatively stable offset indicator on the existing individual route relation features in the transit layer.

When we brainstormed calculating the offset on Friday it was:

nvkelso commented 7 years ago

/cc @bcamper

bcamper commented 7 years ago

We can prototype with existing data, so no rush there (we can hardcode a few layers with different offsets). But for the "real" feature, it's going to be much easier to implement on the client side with separate geometries for each line (even if that means they're duplicated). With separate lines, we can apply an offset to each, using a JS style function that translates a line index number into an offset in pixels. But making the client "multiply" a single geometry into several others based on a feature property would be a significantly greater change to the processing pipeline. While you can currently draw the same feature multiple times, that's based on static layers. There's no facility for dynamically replicating a feature based on arbitrary logic.

nvkelso commented 7 years ago

@bcamper Thanks, that's even easier :) I've updated the main issue description.

zerebubuth commented 7 years ago

Does the offset have to be unique within the tile, or unique "globally"? I had thought that we would assign offsets at junctions, but I'm not sure how we'd encode that into the tile.

Some detailed examples of the output that we want would be very helpful.

bcamper commented 7 years ago

We can make a diagram of what I was hoping to have for Tangram.

cc @meetar

On Fri, Apr 7, 2017 at 8:38 AM Matt Amos notifications@github.com wrote:

Does the offset have to be unique within the tile, or unique "globally"? I had thought that we would assign offsets at junctions, but I'm not sure how we'd encode that into the tile.

Some detailed examples of the output that we want would be very helpful.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/tilezen/vector-datasource/issues/1189#issuecomment-292571270, or mute the thread https://github.com/notifications/unsubscribe-auth/AABBXWes1QQ2PMgZC0TeVl49sBd_F1fUks5rtlh-gaJpZM4MyQK1 .

zerebubuth commented 7 years ago

A diagram would be very helpful, thanks!

nvkelso commented 7 years ago

On the Tangram side @meetar has proposed a PR to add support to JS in https://github.com/tangrams/tangram/pull/547. The assumption there is there are different line geoms (like vector tiles have today) for the different lines, but if an offset is available it'll push the line away. There's some followup to determine if shader versus geom preprocessing is the way to go (more like Mapbox does it).

When Brett was in the SF office last week we made the following sketches, with make a few assumptions:

@zerebubuth can you review the sketches and provide comments, please?

pasted image at 2017_04_13 03_01 pm

pasted image at 2017_04_13 03_00 pm

zerebubuth commented 7 years ago

That's very helpful, thanks!

Taking the example a bit further, how would we assign the [start, center, end] offset values for something like this pair of junctions?

questions

The grey dashed boxes would represent "bundles" of geometries for the same way, but duplicated for each transit line. Assigning offsets along the bundle (the center value) seems pretty straightforward. But how would we want to do it at the junction? The geometry there is basically point-like, although it's likely that the geometries would already be physically offset somewhat if they arrive at different platforms, this offset might be small at mid zooms.

If we're able to offset from the "junction point", then could we assign the offsets around a box (or octagon) at the point? E.g: something like:

box

Or is that kind of geometry manipulation not possible?

nvkelso commented 7 years ago
   \ /    ||
=== + === + ===
    /     |

For the LEFT dark grey box as if it were a node:

For the right dark grey box as if it were a node:

nvkelso commented 7 years ago

@bcamper and @meetar Can you comment on @zerebubuth's diagram in https://github.com/tilezen/vector-datasource/issues/1189#issuecomment-295657520, please? Is that feasible in Tangram for v1?

nvkelso commented 7 years ago

I talked with @bcamper a bit today and will followup here with some more diagrams.

nvkelso commented 7 years ago

Update from the tiles meeting today:

For v1 release in May we're going to limit work in this issue just the "center" offset and punt the "start", "end", and line joining pieces to a future v2 implementation in https://github.com/tilezen/vector-datasource/issues/1221.

bcamper commented 7 years ago

👍 I think being able to build working demos with the center offsets first will help us design the best follow-up (on both client and tiles)

nvkelso commented 7 years ago

For v1 we should only calculate line offsets for not railway, not train transit lines (they would always default to 0). This will help avoid situations where too many double and triple rainbows try to stack along the same right-of-way – and even though trains have colors generally we want to reserve the colour offsets for subway and light_rail / tram.

nvkelso commented 7 years ago

To clarify https://github.com/tilezen/vector-datasource/issues/1189#issuecomment-296407127...

So if there are 11 lines:

Then we'd see a total of these 9 offsets:

nvkelso commented 7 years ago

Punting to next release.