Select to view content in your preferred language

SWF or Other Custom Symbol with ESRI Layer?

2414
4
02-02-2011 12:59 PM
DavidMarley
Frequent Contributor
Is there a way to use SWFs or other custom symbols (PNGs or GIFs) with a standard ESRI operational layer? Or will I need to create some sort of custom graphics layer myself, adding the graphics and assigning their symbol as I do?

The effect I am trying to achieve is that of a flashing red symbol (circle) for features with an attribute above a certain threshold - non-flashing green symbol for others.

From what I can see, all the samples are using ESRI symbols like SimpleMarkerSymbol. 

Thanks in advance.
Tags (2)
0 Kudos
4 Replies
BjornSvensson
Esri Regular Contributor
Yes, you can use a PictureMarkerSymbol:
"The image format can be either JPG, GIF, PNG, SWF or SVG. While SVG images must be embedded within the application, all other image formats can be either embedded within the application or referenced by URL. "

You can search our samples for PictureMarkerSymbol.  It shows five samples including one sample with pulsating swf.  That sample is about time-enabled layers, but I think you can find what you are looking for there.
0 Kudos
DavidMarley
Frequent Contributor
OK cool. Thanks. I must have missed that a SWF can be specified for a PictureMarkerSymbol.

But, a further question: How can I specify the ClassBreaksRenderer / PictureMarkerSymbol when using the ESRI Flex Viewer?  Because there you are not dealing directly with the MXML markup for the map and layers, but rather specifying the layer in the config.xml using the layer tag.  Unless I am missing it, there is no option or parameter to specify your own renderer as part of the layer tag.

I realize I'd probaly have to do some customization within the Flex Viewer to achieve this - but where in the Flex Viewer and it's load/startup cycle would I do this?  Any suggestions?

The samples are pretty good, but they are often not much help when working with the Flex Viewer...
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
David,

   The MapManager is where layers are added to the map so that is where you would handle this.

In the addLayerToMap function is where I define renderers for 9.3 Server featurelayers that don't get the good ArcGIS 10 Server Symbology.

                    case "feature":
                    {
                        var featureLayer:FeatureLayer = new FeatureLayer(url);
                        featureLayer.addEventListener(FlexEvent.HIDE, featureLayer_hideHandler);
                        featureLayer.alpha = alpha;
                        featureLayer.id = label;
                        featureLayer.name = label;
                        featureLayer.outFields = [ '*' ];
                        featureLayer.token = token;
                        featureLayer.visible = visible;
                        featureLayer.useMapTime = useMapTime;
      if (label == "Traffic Cameras")
      {
       var picSymbol:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/i_camera.png",30,30,0,0,0);
       var rend:Renderer = new SimpleRenderer(picSymbol);
       featureLayer.renderer = rend;
      }
      if (label == "Louisville Police Facilities")
      {
       var picSymbol0:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/i_policestation.png",30,30,0,0,0);
       var rend0:Renderer = new SimpleRenderer(picSymbol0);
       featureLayer.renderer = rend0;
      }
      if (label == "Louisville Places")
      {
       var picSymbol2:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/bat.png",30,30,0,0,0);
       var picSymbol3:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/horse.png",30,30,0,0,0);
       var picSymbol4:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/mansion.png",30,30,0,0,0);
       var uniqueValuerenderer:UniqueValueRenderer = new UniqueValueRenderer();
       uniqueValuerenderer.attribute = "NAME";
       var uniqueValueInfos:Array = [];
       uniqueValueInfos.push(new UniqueValueInfo(picSymbol3, "Chuchhill Downs"));
       uniqueValueInfos.push(new UniqueValueInfo(picSymbol2, "louisville slugger factory"));
       uniqueValueInfos.push(new UniqueValueInfo(picSymbol4, "Whitehall Mansion"));
       uniqueValuerenderer.infos = uniqueValueInfos;
       featureLayer.renderer = uniqueValuerenderer;
      }
                        if (useAMF)
                        {
                            featureLayer.useAMF = useAMF == "true";
                        }
                        if (mode)
                        {
                            featureLayer.mode = mode;
                        }
                        if (definitionExpression && definitionExpression != "")
                        {
                            featureLayer.definitionExpression = definitionExpression;
                        }
                        if (proxyUrl && useProxy)
                        {
                            featureLayer.proxyURL = proxyUrl;
                        }
                        if (operationalLayer)
                        {
                            layerObject.layer = featureLayer;
                        }
                        map.addLayer(featureLayer);
                        break;
                    }
0 Kudos
DavidMarley
Frequent Contributor
Nice! That is just what I am looking for.

Thanks Robert!
0 Kudos