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
Labels
archived
Archived because of inactivity
Core
The cross-platform C++ core, aka mbgl
feature
runtime styling
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 andfields
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 tombgl::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
The text was updated successfully, but these errors were encountered: