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

Detect and warn incorrect source-layer #8420

Open
stevage opened this issue Jul 2, 2019 · 2 comments
Open

Detect and warn incorrect source-layer #8420

stevage opened this issue Jul 2, 2019 · 2 comments

Comments

@stevage
Copy link
Contributor

stevage commented Jul 2, 2019

This question on Stack Overflow reminded of this common pain point: when a layer definition includes source-layer that doesn't correspond to any actual source layer, Mapbox-GL simply fails to render anything, with no warning.

My understanding is that the library should have access to the list of actual source layers for any vector source loaded via TileJSON. So in theory it should be possible to check that the requested source-layer is in that list, and if not, output a warning, something like:

Warning: source-layer "trees" does not exist in vector tile source "test". No features will be displayed..

@mourner
Copy link
Member

mourner commented Jul 2, 2019

The problem as I see it is that vector_layers in TileJSON is a non-standard, undocumented feature (see mapbox/tilejson-spec#14), so we can't rely on it. We also can't rely on the actual tile contents because some tiles will often not contain a particular source layer that is generally expected but not in the specific area. So I'm not sure whether we should proceed until TileJSON spec & MVT producers all catch up.

@stevage
Copy link
Contributor Author

stevage commented Jul 2, 2019

Hmm, I can see how Mapbox-GL might not always know what vector layers are available (same goes when tiles are specified by tiles property, without a TileJSON at all). But can it warn when it happens to have that information, and just proceed as currently when it's not there (or in the case of a TileJSON that doesn't include it, or if some future version of the spec drops it...)

Maybe I don't quite get why this feature would be so tightly coupled to that spec, but you're the expert :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants