Problem with label layer

來源:互聯網
上載者:User
Problem with label layer 
Tags: General Topics


iako1May 30 2007 at 4:46 PMEdited 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.


iako1Jun 1 2007 at 12:04 AM

Nobody?


GdevilliersJun 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!


iako1Jun 1 2007 at 3:49 PMEdited 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.

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.