mapbox / simplespec-to-gl-style

Converts GeoJSON styled with simplestyle-spec to a GL Style
ISC License
31 stars 6 forks source link

Migrate to data-driven styling #27

Open 1ec5 opened 7 years ago

1ec5 commented 7 years ago

This library currently creates a separate layer for each individual geometry or feature in the GeoJSON input in order to style it distinctly. Instead, it should create one each of symbol, line, and fill layers and set each layout or paint property to a property function that looks at the relevant property on each feature. Reducing the number of layers could improve performance and would also give us more flexibility with respect to z-ordering.

The following layout and paint properties would need to support data-driven styling:

DDS support for icon-allow-overlap, icon-size, line-cap, and line-join is unnecessary (although it’s already supported for icon-size) because we apply these properties to every symbol or line layer unconditionally.

Incidentally, mapbox/mapbox-gl-js#4087 would make it possible to remove the workaround that clones a path in order to give it both a fill and a stroke with customizable width (stroke-width).

/cc @bsudekum @jfirebaugh