tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.22k stars 290 forks source link

warn when layer name doesn't match a datasource layer #640

Closed meetar closed 6 years ago

meetar commented 6 years ago

When a layer's data block doesn't specify a layername, and the layer's name doesn't match a datasource layer, log a warning to that effect.

Check whether there's any case when a datasource might not have a named layer, eg standalone untiled GeoJSON, and make a provision in that case.

pnorman commented 6 years ago

Isn't a MVT with no layers just an empty file? This sounds like it would warn on lots of valid situations.

meetar commented 6 years ago

I think the more common case would be datasources without layers, which are certainly valid. This as you point out would lead to lots of extraneous warnings.

So a better case for the new warning would be:

Currently this just fails silently.

pnorman commented 6 years ago

Wouldn't this still be a common failure, e.g. if you are rendering a map with a POI layer and you're viewing somewhere with no POIs?

bcamper commented 6 years ago

If I understand the conversation, this is why I hadn't previously added a warning like this. With tiled data in particular, you can't really know where a given layer will or won't be present. I suppose a TileJSON could be used to validate whether a layer is valid, but we haven't had a strong need to support that yet.

What are the cases where the current behavior is a problem? Are you trying to catch spelling errors in layer names?

On Wed, May 16, 2018 at 9:56 PM Paul Norman notifications@github.com wrote:

Wouldn't this still be a common failure, e.g. if you are rendering a map with a POI layer and you're viewing somewhere with no POIs?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tangrams/tangram/issues/640#issuecomment-389719910, or mute the thread https://github.com/notifications/unsubscribe-auth/AABBXcJ6TSBQFMTY9rZKMSw18kuXCH9mks5tzNjYgaJpZM4T6fUl .

meetar commented 6 years ago

rendering a map with a POI layer and you're viewing somewhere with no POIs?

Of course you're right, for some reason when I opened the issue I was imagining that an empty tile would contain a set of empty layers, which is clearly incorrect.

Yes, the original problem case was mismatched or nonexistent layer names, but without some kind of schema to reference there's no way to tell whether a given tile ought to have a given layer.

Closing as unworkable – thanks for the comments!