I'm using the ArcGIS runtime SDK for .Net, version 10.2.7.

I have a point graphic that is symbolised with a TextSymbol. I would like to add a separate polygon graphic to the graphics overlay that covers the extent of the text symbol.

What I have tried is below. It works fairly well, but there is a small difference between the text and the polygon.

 var symbol = GetGraphicSymbol();
 if (symbol == null)
 var text = symbol.Font;

 var size = graphics.MeasureString(symbol.Text, 
     new Font(text.FontFamily, 
 if (size.Width == 0 || size.Height == 0)

 var width = mapView.UnitsPerPixel * size.Width;
 var height = mapView.UnitsPerPixel * size.Height;

I understand that on any scale change the polygon graphic would need to be recalculated.

  • Have a read of gis.stackexchange.com/questions/37667/… – Michael Stimson Jul 13 '17 at 23:30
  • @MichaelStimson that seems to be how to find the value through ArcObjects. I need to do it through the 10.2.7 ArcGIS runtime for wpf. – travis Jul 13 '17 at 23:50
  • I was under the impression that there is little difference between runtime and ArcObjects. Does that interface not exist in your SDK? I can remember doing a similar thing but have misplaced the code.. I was looking for clashing annotation and became constantly frustrated that the polygons generated weren't exactly the same as the text, they were slightly smaller (about 90%) and ended up buffering by a small amount, that might be hacky but it worked. – Michael Stimson Jul 13 '17 at 23:54
  • The .Net runtime doesn't expose interfaces...that I know of. More info -> developers.arcgis.com/net/10-2 – travis Jul 14 '17 at 0:13
  • 1
    If you just need to add a background to the text, the textsymbol has a background property and will render a box around it. Can you use that instead? Alternatively create a swatch from the text symbol, and measure the size of the image generated (just beware that this is quite expensive if you need to do it for a lot of texts) – dotMorten Jul 27 '17 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.