Checked for duplicates
Yes - I've already checked
Alternatives considered
Yes - and alternatives don't suffice
Related problems
No response
Describe the feature request
Currently
Right now, the only way to custom style each feature in a vector layer, with say a fill color, is to include that color itself somewhere within each feature's properties object. This means that if ever we want to restyle that feature, we'd have to update that field in the geojson itself.
Task
Often such color field is derived from other fields within the metadata. This ticket is to add support for configuring a value-to-color mapping for vector layers.
Sample use case
For instance, I might have a field called direction that is a integer that goes from 0 to 360. This new feature would enable me to, through the /configure page, state that geojson features shall be styled blue if direction is 0 and gradiently red as direction approaches 360.
How styles are currently applied
Vector layers are styled in the constructVectorLayer function.
The priority of stylings is defined in https://nasa-ammos.github.io/MMGIS/configure/formats/vector-styling. Roughly speaking:
properties.style.* fields take priority
- followed by the configured "From Property" fields in the Style Tab
- followed by the color-pickers/slider values in the Style Tab
- followed by some default
One idea
One idea to incorporate style mappings into /configure is to include it into the Legend Tab.
The Legend Tab entries would each get four new components:
- A text input for
property name
- A text input for
property value
- A checkbox for
style matching feature according to this
- A checkbox for
hide this item from the legend
Notes
- Ideally the style mapping works across integer, floating point, boolean, and string fields.
Checked for duplicates
Yes - I've already checked
Alternatives considered
Yes - and alternatives don't suffice
Related problems
No response
Describe the feature request
Currently
Right now, the only way to custom style each feature in a vector layer, with say a fill color, is to include that color itself somewhere within each feature's properties object. This means that if ever we want to restyle that feature, we'd have to update that field in the geojson itself.
Task
Often such color field is derived from other fields within the metadata. This ticket is to add support for configuring a value-to-color mapping for vector layers.
Sample use case
For instance, I might have a field called
directionthat is aintegerthat goes from0 to 360. This new feature would enable me to, through the /configure page, state that geojson features shall be styled blue ifdirectionis0and gradientlyredasdirectionapproaches360.How styles are currently applied
Vector layers are styled in the
constructVectorLayerfunction.The priority of stylings is defined in https://nasa-ammos.github.io/MMGIS/configure/formats/vector-styling. Roughly speaking:
properties.style.*fields take priorityOne idea
One idea to incorporate style mappings into /configure is to include it into the Legend Tab.
The Legend Tab entries would each get four new components:
property nameproperty valuestyle matching feature according to thishide this item from the legendNotes