ThinkGeo.com    |     Documentation    |     Premium Support

Labelling Polygons

Hi,


I am trying to label polygonal shapes on my map using a text style. Here's a code fragment illustrating my approach:


myTextStyle = new TextStyle(IdFileIdColumn, new GeoFont("Consolas", 10F),new GeoSolidBrush(GeoColor.StandardColors.Black))


{


SuppressPartialLabels = true,


OverlappingRule = LabelOverlappingRule.NoOverlapping, 


FittingPolygonFactor = 0.8,


FittingPolygon = true


};


myShapeFile.ZoomLevelSet.GetZoomLevels()[zoomLevelIndex - 1].CustomStyles.Add(myTextStyle);


The labels are frequently displayed outside the corresponding polygon's boundary. Is there a better way of handling this issue ?


 



Hi Amritayan, 
  
 Thanks for your post. 
  
 I think your code is right, but I am not very sure what you mean the labels displayed outside the polygon’s boundary, is some part of label outside the boundary or the entire label outside the boundary or some other situation? Could you provide a screen-shot? I think it will be very helpful. 
  
 Thanks 
 James 


Thanks for the quick reply. It seems to be working fine now. There were some other issues with my code.



Amritayan, 
  
 You’re welcome. I am glad this is working for you.  
  
 Please let me know if you have more questions. 
  
 James