Add configuration option to icon styles: referenceMapScale, minIconScaleFactor, maxIconScaleFactor#2211
Conversation
|
Added the option to control icon scales using feature attributes - similar to what already works for rotation, e g: |
|
Now the above also works for text, circle or other basic shape styles, e g: For text styles, the offset parameters are also scaled accordingly. |
steff-o
left a comment
There was a problem hiding this comment.
LGTM.
I was pretty confused with the rotation by attribute functionality, as if a feature has null in that column, the style part is not displayed at all while a layer without the column using the same style defaults to 0. It seems like rotation for icon already worked like that so nothing to complain about.
If the symbol consists of many parts (like the origo-logo) it becomes chatty to configure each part to scale each part, which could be solved by allowing all settings to be set at top level for the symbol and acta as default for each part. But that would not be worth to implement as there certainly be cases where a user would want to have different options for the part, so we would have to support both cases, and since most symbols are icons or just one part I don't think it is worth the hassle.
Fixes #2210.
Lets icons, texts, circles and other basic shape styles grow and shrink when a user zooms in and out in the map.
"origo-logo": [ [ { "label": "Origokommuner", "icon": { "src": "img/kompass.svg", "referenceMapScale": 50000, "minStyleScaleFactor": 0.01, "maxStyleScaleFactor": 0.2 } } ] ],10000for a reference map scale of 1:10 000).scaleandrotationparameters are now also supported on icon, text, circle and the other basic shape styles, including feature attribute substitution.These scale values play nice with the regular
scaleparameter.Also, if the
"updateWhileAnimating": trueproperty is added to a layer with a style with a referenceMapScale, it will make the scaling of the style smooth as the user zooms:"layers": [ { "name": "origo-cities", "title": "Origokommuner", "group": "root", "source": "data/origo-cities-3857.geojson", "style": "origo-logo", "updateWhileAnimating": true, "type": "GEOJSON", [...]EDIT: Updated the proposed names for the min- and max icon scale factors.
EDIT 2: Updated the names and description again to extend the issue to also generalize the scale and rotation handling so that it works the same for text, icon, circle and the other basic shape styles.