[Maps] use coalesce to ensure number always passed to interpolate for data driven size styling (#38427) (#39131)

* [Maps] use coalesce to ensure number always passed to interpolate for data driven size styling

* update docs with behavior when feature property is not defined

* Update docs/maps/vector-style.asciidoc

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/maps/vector-style.asciidoc

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* move first note into description paragraph

* add coalesce wrapper around icon-size extraction expression
This commit is contained in:
Nathan Reese 2019-06-17 18:42:04 -06:00 committed by GitHub
parent 493e14ea5a
commit cf0b1200ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -41,8 +41,12 @@ image::maps/images/vector_style_static.png[]
Use data driven styling to symbolize features from a range of numeric property values.
To enable data driven styling, click image:maps/images/gs_link_icon.png[] next to the property.
This button is only available when vector features contain numeric properties.
NOTE: The image:maps/images/gs_link_icon.png[] button is only available for vector features that contain numeric properties.
NOTE: *The Fill color* and *Border color* style properties are set to transparent and are not visible
when the property value is undefined for a feature.
*The Border width* and *Symbol size* style properties are set to the minimum size
when the property value is undefined for a feature.
The image below shows an example of data driven styling using the <<add-sample-data, Kibana sample web logs>> data set.
The *kibana_sample_data_logs* layer uses data driven styling for fill color and symbol size style properties.

View file

@ -415,7 +415,7 @@ export class VectorStyle extends AbstractStyle {
return [
'interpolate',
['linear'],
['feature-state', targetName],
['coalesce', ['feature-state', targetName], 0],
0, minSize,
1, maxSize
];
@ -554,7 +554,7 @@ export class VectorStyle extends AbstractStyle {
mbMap.setLayoutProperty(symbolLayerId, 'icon-size', [
'interpolate',
['linear'],
['get', targetName],
['coalesce', ['get', targetName], 0],
0, iconSize.options.minSize / halfIconPixels,
1, iconSize.options.maxSize / halfIconPixels
]);