Labeling FeatureLayer the same as in the mxd

1768
1
06-17-2016 08:56 AM
Hernando_CountyProperty_Apprai
New Contributor III

I have an mxd that uses a picturesymbol in it's label along with the value.  Basically, it's a picture of a callout (a png file) and the text for the field sits on top of it.  The labeling works fine when I add the layer as an ArcGISDynamicMapSericeLayer, but when I add it as a FeatureLayer(so I can click on it and display a custom infowindow) it doesn't show the labeling at all.  I saw that I would have to a LabelLayer but I'm not sure how to go about setting it up to have a picturemarkersymbol as it's background.  Any ideas?

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Priscilla,

  You should continue to use ArcGISDynamicMapSericeLayer, as this is the only way you will maintain the exact label you setup in ArcMap. The ArcGISDynamicMapSericeLayer does support a custom info window. The way you set the info window for a FeatureLayer is fl.setInfoTemplate well the ArcGISDynamicMapSericeLayer is some what similar.

DL.setInfoTemplates.

demographicsLayer.setInfoTemplates({
       
1: { infoTemplate: _blockGroupInfoTemplate },
       
2: { infoTemplate: _countyCensusInfoTemplate }
     
});

Here is a sample:

Add two dynamic maps | ArcGIS API for JavaScript