Hi. A little newer to ArcGIS. I'm trying to render a simple marker via a feature layer renderer but pass a dynamic angle value. We have a number of different markers based on certain field values so we're using the `unique-value` type.
Layer looks like this:
layerRef.current = new FeatureLayer({
title : stuff..
id : stuff..
source : graphics
objectIdField : stuff..
outFields : stuff..
fields : stuff..
renderer : getHistoryByAssetRenderer(),
popupTemplate : stuff..
});
Here's a dumb version of the array of the source objects:
const graphics = [
{
eventType : 'direction',
angle : 67
},
{
eventType : 'turning'
angle. : 234
}
]
then the renderer looks like so:
const getHistoryByAssetRenderer = () => ({
type : 'unique-value',
field : 'eventType',
uniqueValueInfos : [
...,
{
value : 'direction',
symbol : {
type : 'simple-marker',
style : 'path',
path : EVENT_TRIANGLE_PATH,
angle : HOW DO I GET PASS THE ANGLE HERE???
size. : 10
color : fillColor,
outline : {
color : outlineColor,
width
}
}
]
})
So of course the renderer handles finding the `eventType` field and rendering the marker based on the that field, but i'm not sure how to pass the angle to the symbol so the marker can be rotated.
Some notes on what I've tried:
Not sure if there is a way to use Roatation but it seems to balk when the renderer type is `unique-value`
Similar question:
Solved! Go to Solution.
Maybe try using a Rotation VisualVariable to do this task? If it doesn't work for you, having a simple codepen (or similar) so we can see the code and experience the issue really helps.
Maybe try using a Rotation VisualVariable to do this task? If it doesn't work for you, having a simple codepen (or similar) so we can see the code and experience the issue really helps.
Ah thanks John. It worked once I added `angle` to the fields list that gets passed to the renderer (which I marked above as 'stuff'). Then added this to the renderer:
visualVariables : [{
type : 'rotation',
field : 'angle',
rotationType : 'geographic'
}]