How to add simplemarkersymbol and textsymbol to one graphic

747
2
01-15-2020 02:16 AM
BaranDemir
New Contributor

Hello,

How can I combine a  simplemarkersymbol and textsymbol?

I have the following code in js, but that shows one or the other:

            var pointGraphicA = new Graphic({
                geometry: point,
                symbol: simpleMarkerSymbol,
                attributes: attributes,
                popupTemplate: popupTemplate,
                symbol: textSymbol
            });

Kind regards,

Baran

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Baran,

   A graphic can only have one symbol period. So to get a TextSymbol in the same location you have to add another graphic with the TextSymbol. The is no concept of a compositeSymbol like there was in other esri libraries.

0 Kudos
mgeorge
Esri Contributor

While Robert Scheitlin, GISP‌ is right that we don't yet have a stable way of handling composite symbology in the JSAPI yet, we do have beta CIM support which I think should allow you to achieve what you are looking for. You could also go the FeatureColletion + label route if you want deconfliction (adding support for an option to disable label deconfliction is in the works). 

I would take a look at CIMSymbol | ArcGIS API for JavaScript 4.14