Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Enumerators for layers and fields within a source #7255

Closed
1ec5 opened this issue Dec 1, 2016 · 1 comment
Closed

Enumerators for layers and fields within a source #7255

1ec5 opened this issue Dec 1, 2016 · 1 comment
Labels
archived Archived because of inactivity Core The cross-platform C++ core, aka mbgl feature runtime styling

Comments

@1ec5
Copy link
Contributor

1ec5 commented Dec 1, 2016

It should be possible for the developer to programmatically discover the layers in a vector source and the properties (fields) within those layers.

In the style specification, the source-layer documentation implies that it isn’t required for a single-layer vector source, that the sole layer will be autodetected. However, #6780 points out that layers aren’t currently autodetected, so perhaps this feature will pave the way for that enhancement. (See also mapbox/mapbox-gl-style-spec#547, which is about clarifying the style specification documentation.) Having a way to enumerate the layers and properties would help us avoid hard-coding Mapbox Streets properties for #7031 and similar features. A list of valid properties could also help us validate property names used in property functions.

It looks like Mapbox-hosted vector TileJSON manifests specify the necessary data in an undocumented vector_layers property and fields properties within each layer. (Layer and property descriptions are also present, but they probably aren’t worth parsing and keeping in memory for the likely use cases.) mbgl::style::TileSourceImpl::parseTileJSON() doesn’t currently parse these properties. If it isn’t a good idea to rely on this TileJSON information, I wonder if there’s a way to get access to mbgl::VectorTileLayer::keys.

At the iOS and macOS SDK level, I think we’d want a attributeNamesByLayer property that maps source layer identifiers to sets of property names. attributeNamesByLayer would either live on MGLVectorSource or on a new MGLVectorTileSet that inherits from MGLTileSet.

/cc @jfirebaugh @incanus @boundsj @ericrwolfe

@1ec5 1ec5 added Core The cross-platform C++ core, aka mbgl feature GL JS parity For feature parity with Mapbox GL JS runtime styling labels Dec 1, 2016
@jfirebaugh jfirebaugh removed the GL JS parity For feature parity with Mapbox GL JS label Dec 1, 2016
@stale stale bot added the archived Archived because of inactivity label Nov 16, 2018
@stale
Copy link

stale bot commented Nov 23, 2018

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Nov 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity Core The cross-platform C++ core, aka mbgl feature runtime styling
Projects
None yet
Development

No branches or pull requests

2 participants