Problem with label layer

Problem with label layer 
Tags: General Topics

May 30 2007 at 4:46 PM
Edited May 30 2007 at 11:16 PM
Hi there, I've got a map that shows the provinces of a region. My map is composed of 2 layer: a vector layer and a label layer. I've a problem with the label layer, because sometimes I've got a province's name that appear in great measure in another province. Is there a way to put a name inside the province's boundary?I've got only a shapefile and I take the provinces name from a shapefile column.
Thanks.

Jun 1 2007 at 12:04 AM
Nobody?

Jun 1 2007 at 6:49 AM
Hi Jako

I am not sure what you mean by "appear in great measure in another province" if it is that the same name appear in a other province then the shapefile .dbf has some duplicate names , Download a map viewer to see if this is the case if not then something is wrong with you Sharpmap data provider (Does other maps show correctly!)

As far as showing names in the centroid of Prov region can be done by using the Label name field of the same datasource of the shapefile for Provinces..shp but new label layer - something like

Layers.LabelLayer layASLabel = new SharpMap.Layers.LabelLayer("labels");
layASLabel.DataSource = your shapefile layername.DataSource;
layASLabel.LabelColumn = "your column name";
layASLabel.Style.Font = new Font("Arial", 12, FontStyle.Bold);
layASLabel.Style = new SharpMap.Styles.LabelStyle();
layASLabel.Style.ForeColor = Color.Black;
layASLabel.Style.Offset = new PointF(10, 0);
layASLabel.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
layASLabel.SmoothingMode = SmoothingMode.AntiAlias;
layASLabel.SRID = 7542; //This is your spatial ref no
layASLabel.LabelFilter = SharpMap.Rendering.LabelCollisionDetection.ThoroughCollisionDetection;
layASLabel.Style.CollisionDetection = true;

I don'y know what you've done but hope it helps!


Jun 1 2007 at 3:49 PM
Edited Jun 1 2007 at 11:04 PM
Hi Gdevilliers,
thanks for your post. My shapefile is correct, the problem is that the label are put in center, middle, top, bottom,... respect to the bounding box, so if a province have a particulare shape I can have the label that "appear in great measure in another province".
I hope you can understand me.
Thanks.
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值