Select to view content in your preferred language

Symbology from FeatureLayer

1311
9
09-29-2011 03:48 AM
BrunoPereira1
Deactivated User
Hi,

I got this problem, I have a FeatureLayer from Url

var featureLayer:FeatureLayer = new FeatureLayer(url);

But, the property Renderer (about symbology) in the FeatureLayer is null, and I want to change the the symbology properties.
I got a Polygon with the property Style "solid" and I want to change and set to "backwarddiagonal".


Thanks.
Bruno
Tags (2)
0 Kudos
9 Replies
RobertScheitlin__GISP
MVP Emeritus
Bruno,

   Simply define one in code and assign it to the feature layer.

                            var sr:SimpleRenderer = new SimpleRenderer();
                            var oLine:SimpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,0xff0000,0.8,1);
                            sr.symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_BACKWARD_DIAGONAL,0xff000,0.8,oLine);
                            featureLayer.renderer = sr;
0 Kudos
BrunoPereira1
Deactivated User
Hi.. in a url property about symbology i have this

Renderer:
Simple Renderer:
Symbol:
Simple Fill Symbol:
Style: esriSFSSolid, Color: [85, 255, 0, 255]
Outline:
Simple Line Symbol:
Style: esriSLSSolid, Color: [Undefined], Width: 0,4
0 Kudos
BrunoPereira1
Deactivated User
But how I get color properties?

Thanks!
0 Kudos
BrunoPereira1
Deactivated User
I can set a new renderer, but I have to keep the original color

Thanks
Bruno
0 Kudos
BrunoPereira1
Deactivated User
But how I get color properties?

I can set a new renderer, but I have to keep the original color

Thanks
Bruno



Bruno,

   Simply define one in code and assign it to the feature layer.

                            var sr:SimpleRenderer = new SimpleRenderer();
                            var oLine:SimpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,0xff0000,0.8,1);
                            sr.symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_BACKWARD_DIAGONAL,0xff000,0.8,oLine);
                            featureLayer.renderer = sr;
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Bruno,

   Since the renderer is null I guess you would have to get the first feature from the feature layer and then get the symbol from the graphic and get all the way down to the simpleFillSymbol's color property. I don't have any code examples for this.
0 Kudos
BrunoPereira1
Deactivated User
Robert,

I've tryed that, but the symbol is null, like the FeatureLayer...
When I add that FeatureLayer on myMap the color and everything is the same way on the Mapserver, I just need to add with a different style.


I look Inside the FeatureLayer I can see on debug mode the property FeatureLayer > Extent > DefaultSymbol and there I have the style, but I don't have access, I can't set that property!
I can't get properties of the symbol from the FeatureLayer!

😞

Thanks!
Bruno Faria


Bruno,

   Since the renderer is null I guess you would have to get the first feature from the feature layer and then get the symbol from the graphic and get all the way down to the simpleFillSymbol's color property. I don't have any code examples for this.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Bruno,

   You can get the renderer from the drawingInfo. Make sure that the layer is loaded first though by calling this line after the featureLayer.load event

featLay.layerDetails.drawingInfo.renderer
0 Kudos
BrunoPereira1
Deactivated User
Robert, Thanks for Help!

Bruno,

   You can get the renderer from the drawingInfo. Make sure that the layer is loaded first though by calling this line after the featureLayer.load event

featLay.layerDetails.drawingInfo.renderer
0 Kudos