title: Using Sql Spatial Data (C#) to find the "visual" center of irregular polygons
body: <p>I'm drawing regions (using <code>SqlGeometry</code>/<code>SqlGeography</code> and translating them to the WPF <code>LocationCollection</code> equivalent) on the Bing Maps WPF Control and needed to label them.  I got the labels drawn on the regions and attached them to the point found by <code>STCentroid()</code>.  Of course as you imagine this is a problem with the 'U' or 'C' shaped regions where the centroid ends up outside the region, which makes the label incorrect.</p>
  
  <p>Is there a way using <code>SqlGeometry</code>/<code>SqlGeography</code> to find the "visual" center or perhaps find the largest circle that can fit in the shape and use that center?  I've tried <a href="https://gis.stackexchange.com/questions/724/how-can-i-find-a-point-inside-a-polygon-in-postgis">various methods</a> using <code>STPointOnSurface()</code> but it seems that <code>STPointOnSurface()</code> always picks a point on the edge like so DCREHA (the label for the bottom dark green region always ends up on the edges:</p>
  
  <p><a href="https://i.stack.imgur.com/DpG8r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DpG8r.png" alt="enter image description here"></a></p>