Dynamic Feature Layer Symbology

4136
11
12-08-2010 03:21 AM
RadmilPopovic
New Contributor II
Hi,

My map consist of polygons where each polygon has many attributes. In ArcMap I can show attributes??? values by symbolizing layers  using Categories/Quantities/Field/Classification tools in Layer Property. Changing classifications I change the map geometry.
My question is how to achieve the same functionality in Flex application so that the user on the client side changing the  number of classes or break values can change the map. Still more,  f.e moving slider which represents  nominal values of one attribute from Xmin to X max.
I still use ArcGis 9.3.1 and as I understood, ArcGis Server  9.3.1 couldn???t do it since REST API  is stateless and symbology from map service isn???t used. Does ArcGis Server 10 support dynamic symbology?
Any idea/example how to make Flex appl. where user can explore/change the map by changing value of one layer???s attribute ???
Tags (2)
0 Kudos
11 Replies
WallaceBezerra
New Contributor II
Rad,

to get the symbology in a dynamic way in 9.3.1, you can use the SOAP API inside Flex (using the Webservice class). You need to investigate if all the changes you made into your layer (i.e. Classification) is applied and returned from the SOAP API.
0 Kudos
RadmilPopovic
New Contributor II
Thanks,
I know that SOAP API is option, but since i'm not experienced in SOAP wonder if it is better to upgrade to ver. 10 and use FeatureLayer, selv I havn't used ver 10 and i'm not sure actually how to that with FeatureLayer...
0 Kudos
DasaPaddock
Esri Regular Contributor
You can use the FeatureLayer with ArcGIS Server 9.3. It won't get its renderer from the server so you'll need to configure that in your app.

Here's one sample showing a renderer set on a GraphicsLayer which you can switch for a FeatureLayer:
http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=Renderer

Here's another sample showing a FeatureLayer using a 9.3 service and a renderer:
http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=FeatureLayer_InfoWindow

You can modify the renderer at runtime and then have the FeatureLayer redraw by resetting its renderer property.
0 Kudos
ab1
by
Occasional Contributor II
Is it possible to use renderers like in the examples provided by dpaddock but using Actionscript?
0 Kudos
AnthonyGiles
Frequent Contributor
Yo_Haha

Yes, anything written in mxml can also be written in ActionScript. Take a look at the API Reference:

http://resources.arcgis.com/en/help/flex-api/concepts/index.html#//017p00000028000000

Regards

Anthony
0 Kudos
ab1
by
Occasional Contributor II
Anthony,

Thanks for the reply.
I have a question. I have a feature layer that I'd like to display using a SimpleMarkerSymbol. So I'm using the following code:
var psi:FeatureLayer = new FeatureLayer("url");
psi.definitionExpression = "ID_PDI IN " + listePDI; // listePDI is a string like this : "(12, 76, 45)"    
var symbol:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 0x00FF00);
psi.renderer = new SimpleRenderer(symbol);
Main(this.parentApplication).mainMap.addLayer(psi); // because the feature layer is declared inside a <fx:component>


The problem is that I get a black screen when I execute that code. When I comment the line :
psi.renderer = new SimpleRenderer(symbol);
I don't have a black screen but I don't get the symbol I want either.

Do you have any hint?

Regards.
0 Kudos
AnthonyGiles
Frequent Contributor
Is it because you are missing your marker size when you create your simple marker symbol:

var symbol:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 0x00FF00);

the function definition is:

SimpleMarkerSymbol(style:String, size:Number = 15, color:Number = 0x000000, alpha:Number = 1, xoffset:Number = 0, yoffset:Number = 0, angle:Number = 0, outline:SimpleLineSymbol = null)

Regards

Anthony
0 Kudos
ab1
by
Occasional Contributor II
I thought all parameters of the function, except style, were optional since they have by default values. Well, that's not the case!
I added all other parameters and it works.
Thanks Anthony 🙂

Regards.
0 Kudos
AnthonyGiles
Frequent Contributor
Please don't forget to mark the post as answered,

Thank you

Anthony
0 Kudos