AnsweredAssumed Answered

Dynamically creating compositeSymbol with pictureMarker and textMarker symbols

Question asked by TerryCoe on Dec 27, 2018
Latest reply on Dec 28, 2018 by TerryCoe

I am trying to create Composite Symbols that contain both a Picture Marker Symbol and a Text Symbol. 

for some reason, the picture Marker Symbol is not consistently created in the composite symbol. So I am hoping that someone here can see what has been done wrong and help me out. Using C#, here is my code:


private async void SetMapSymbols()
var previousLayer = GraphicsLayer[SEARCH_LAYER];

var graphicsOverlay = new GraphicsOverlay() { Id = SEARCH_LAYER };
var graphicList = new List<Graphic>();

int order = 0;

foreach (RequestInfoModel entry in PermitList)

if (entry.SiteGeoLat == null || entry.SiteGeoLong == null) continue;

var pointAttribList = ConvertObjectToDictionary(entry);
DictionaryUtility.AddItemTodictionaryAttribute(pointAttribList, ORDER_ATTRIBUTE, order.ToString());
var geo = entry.AltSiteGeoLat != null && entry.AltSiteGeoLong != null ? WebMercatorUtility.ConvertToMercator(entry.AltSiteGeoLong.Value, entry.AltSiteGeoLat.Value) : WebMercatorUtility.ConvertToMercator(entry.SiteGeoLong.Value, entry.SiteGeoLat.Value);
var graphic = new Graphic(
new MapPoint(geo.Lon, geo.Lat, new SpatialReference(SPATIAL_REFERENCE)),
string.IsNullOrEmpty(entry.InspectorArea) ? await SymbolUtility.CreateSymbols(order.ToString(), SymbolTypes.Blue, SymbolShapes.Pin) :
await SymbolUtility.CreateSymbols(order.ToString(), SymbolTypes.Red, SymbolShapes.Arrow));
if (entry.SiteGeoTypeCode != MAPPABLE)
graphic.Symbol = string.IsNullOrEmpty(entry.InspectorArea) ? await SymbolUtility.CreateSymbols(order.ToString(), SymbolTypes.Blue, SymbolShapes.Pin2) :
await SymbolUtility.CreateSymbols(order.ToString(), SymbolTypes.Red, SymbolShapes.Arrow2);



graphicList.ForEach(x => graphicsOverlay.Graphics.Add(x));



as you can see, i am awaiting the SymbolUtility, so here is that code:


public static async Task<Symbol> CreateSymbols(string text, SymbolTypes type, SymbolShapes shape)
var iconPath = string.Empty;
iconPath = string.Format(@"pack://application:,,,/Images/{0}_{1}.png", type.ToString(), shape.ToString());

var pc = new PictureMarkerSymbol(new Uri(iconPath, UriKind.RelativeOrAbsolute));
pc.Width = 30;
pc.Height = 30;

var cm = new CompositeSymbol();
var ts = new TextSymbol()
Color = Colors.Black,
FontStyle = FontStyle.Normal,
FontDecoration = FontDecoration.None,
FontFamily = "Arial",
FontWeight = FontWeight.Bold,
Size = 14,
VerticalAlignment = VerticalAlignment.Middle,
HorizontalAlignment = HorizontalAlignment.Center,
OffsetY = shape == SymbolShapes.Arrow ? 5 : 0

ts.Text = text;

return await Task.Factory.StartNew<Symbol>(() => { return pc; });

here is a screen grab of 1 symbol that generated properly, and 2 that didn't:

picture of 1 icon rendering properly and two that do not

I have created a thread on StackOverflow here, but a person there directed me here to ask. Thank you for reading this far. any help would be greatly appreciated.



Here is the additional info requested below:

picture symbol for testing

the graphic.Geometry :


the Spatial Reference = 3857