Is it possible to change the layer's paint attribute while rendering circles on a map?
See original GitHub issueHello! I want to draw differently colored circles on a map using Layer's paint
attribute and a Feature
. Essentially, my code currently returns a feature to a layer, allowing a circle to be drawn at the specified coordinates. My problem with that implementation is that I cannot change the Layer's paint
attribute while still drawing circles. Therefore, this led me to try the following code which results in no circles drawn on the map:
<Layer id="layer1" type="circle">
{array.map((element, i) => {
return (
<Layer id="second" type="circle" paint={{boolOperator ? 'blue' : 'green'}}
<Feature coordinates={[0,0]} />
</Layer>
)
})}
</Layer>
Is it possible to pass a Layer
to another Layer
, which then draws the circle on the map given the bottom Layer's paint
attribute? The code above is meant to change the circle’s color if the boolOperator is either true or false, which changes per circle.
I appreciate any help! Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Shape attributes, paint operations, and path operations for ...
Learn how to add attributes—paths, paint operations, and path operations—to layers using the Tools panel or the Timeline panel.
Read more >Layers | Style Specification | Mapbox GL JS
Layout properties appear in the layer's "layout" object. They are applied early in the rendering process and define how data for that layer...
Read more >Symbology in vector tiles—ArcGIS Pro | Documentation
Vector tiles can be created from feature layers with symbology that varies by transparency, color, rotation, and size.
Read more >Painting: Filling, Stroking and Marker Symbols — SVG 2
The fill and stroke properties, defined below, are used to specify the paint used to render the interior of and the stroke around...
Read more >3.2. Lesson: Symbology - QGIS Documentation
3.2.3. basic Follow Along: Changing Symbol Structure¶ · Open the Layer Properties window for the landuse layer. · In the Symbol Layers panel,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The property name can be arbitrary. “Color” will work. You need to specify the layer’s paint to use that named property.
‘circle-color’: [‘get’, ‘xyz’] (in the layer’s paint options) should read the xyz property of the feature and use it for painting its corresponding circle (if I remember the syntax correctly by heart)
@mklopets That works, thank you very much! I appreciate all your help with this issue.