Is it possible to get a feature and rotate the graphic based upon a field of data in that feature?
This was a good tutorial,
Renderer with proportional symbols and rotation | ArcGIS API for JavaScript
And, I was able to see how to rotate and scale simple markers, how would I grab the current graphic for a feature and then rotate it?
Thanks,
Morgan
That works, but I would like to grab the features from a layer, and use the graphics they have configured already and just rotate the graphic based upon a field.
I have a layer of points with a custom graphic on it, and based upon a heading field I want to render the graphic to point different ways. Do I have to get the collection of features from the layer, and add them to the map in javascript, or can set something on the layer in javascript and then just add that layer to the map.
In that case you can simply apply the render for your layer. It's there in the sample that you are using.
var markerSym = new SimpleMarkerSymbol().setPath("M14.5,29 23.5,0 14.5,9 5.5,0z"); markerSym.setOutline(new SimpleLineSymbol().setWidth(0.5)); markerSym.setColor(new Color("red")); var renderer = new SimpleRenderer(markerSym); renderer.setRotationInfo({ field:"WIND_DIRECT", type:"geographic" }); renderer.setSizeInfo({ field:"WIND_SPEED", minSize:3, maxSize:20, minDataValue:5, maxDataValue:50 }); layer.setRenderer(renderer);
Is there a way to get my current renderer for my feature layer?
If it always null when i try and get it from the feature layer class.
For FeatureLayer, I think it will be null unless you define it at client side.
You can consider using ArcGISDynamicMapServiceLayer and it's DynamicLayerInfos which can return the current rendering information.