Be smarter about Mapbox layer creation for GeoJSON sources
Closed this issue · 0 comments
Starting with changes introduced in #956, we treat GeoJSON layers as combinations of Mapbox fill
, symbol
, and line
layers, anticipating GeoJSON sources that might have any combination of Polygon
, Point
, and LineString
geometry in them.
Furthermore, we allow GeoJSON sources to be styled with zoom style rules in the config, creating the need for a set of fill
, symbol
, and line
layers for each style condition. So the total number of layers created is 3 multiplied by the number of style conditions.
For GeoJSON sources that don't contain multiple geometry types this approach creates a lot of "dead" layers whose filters will never apply to any geometry. This might be a performance bottleneck, and we might want to think about a more intelligent way of building layers to support GeoJSON sources.