Need help using graphics

609
2
06-07-2012 11:43 AM
MikeOnzay
Occasional Contributor III
After reading all about graphics and graphicLayer I'm still somewhat confused.

If I add a layer to a map it displays the map feature (or graphic? Is that the right terminology?). Is the default symbol what is listed in the service properties?

If I want to change the color do I create a symbol and add it to a graphicsLayer and then add it to the map? Does this mean that I am essentially drawing on top of the default symbol that draws first? Is it really displaying twice?

How would I change the color and add it to the map?



var imageParameters = new esri.layers.ImageParameters();
 
    imageParameters.layerIds = [0];
    imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW;
    imageParameters.transparent = true;
 
 var dLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer",{"imageParameters":imageParameters});

 
 map.addLayer(dLayer);
0 Kudos
2 Replies
ShreyasVakil
Occasional Contributor II
If I add a layer to a map it displays the map feature (or graphic? Is that the right terminology?). Is the default symbol what is listed in the service properties?


When you add a DynamicMapServiceLayer to map, it adds the default symbology from the Map Service. You cannot change the symbology at 10.0, but at the new release of ArcGIS Server 10.1, has a new layer called as Dynamic Layer which is different than the DynamicMapServiceLayer where you can provide the symbology you want, particular layers you want from the map service etc.

If you want to add your own symbology to map service, you can use FeatureLayer which has the property to change the symbology. Feature Layer is a special type of Graphics Layer. One of the reasons you may use graphics layer is when you perform some tasks and get the results from the server and want to show the results on map.(Take this scenario, after performing a QueryTask you get the returned FeatureSet as points and if you want to show it on the map, you'll first create a graphics layer and add these returned points to this Graphics Layer and then add this GraphicsLayer to the map.)
0 Kudos
JeffPace
MVP Alum
As a developer, please for the love of pete do not call this new layer type a "dynamiclayer".  There is already enough confusion between a layer (mapservice) layer (api), etc..

The functionality sounds great, just please pick a different name.
0 Kudos