This project has moved. For the latest updates, please go here.

Quality labellayer in maps

Topics: SharpMap v2.0
Sep 6, 2007 at 6:31 AM
Hi, I'm new to Sharpmap. Doing a project in Sharpmap. I have placed the shape file and label layer. The shape file has highways, main roads and street level map. What i need is according to the zoom level the roads and their names should be clearly visible. All the roads are there in one shape file. This is very urgent.
Sep 6, 2007 at 8:20 PM
Hi umasam -

Are the labels not showing up at all or are they unreadable?
Sep 7, 2007 at 7:23 AM
The labels are unreadable upto particular zoom level. Only at the maximum zoom level the main road labels are shown.

Thanks for the reply
Sep 9, 2007 at 10:40 AM
Have you set the MinVisible property for the label layer? If you set this property to the extents of the layer, you won't see the labels. Setting it to zero will show them at smaller zoom levels.
Sep 10, 2007 at 12:28 PM
Still I could could not see the labels while initializing the map. The labels are visible at second or third zoom click. How should I calculate the minvisible and maxvisible?. Also I need the main road layer should be visible at first. In dbf we have a column called 'CATEGORY'. According to which we want to show the street layers.
Sep 10, 2007 at 3:43 PM
Hi umasam -

Please forgive me, but I'm still unclear about a few things in order for me to give you a good answer. First, I notice the category for this post is SharpMap v2.0, but I assume you are really using v1.0, correct? If you are using v1.0, the labels are probably too small until you zoom in. You're MinVisible and MaxVisible are probably ok. If you want labels to be visible for only certain roads at first, you will need to use a GetLabelMethod delegate and assign it to the LabelLayer's LabelStringDelegate property. This way, you can determine how and what to display for the label on a feature-by-feature basis.

Second, I'm not clear about your data. Are all roads in one shapefile or are main roads in a separate shapefile?
Sep 12, 2007 at 3:43 AM
Yeah.. I am using SharpMap v1.0.

Main roads and allroads in different shapefile. But in MainRoad shape file itself has different category levels. I Want to show only specific road names of mainroadlayer.

Please, Can you give me LabelStringDelegate property example code. I not able to find the example code.

I tried to create a datatable by adding datarow for particular Roadlevel. (Filtering the road by category). I could not assign the datatable to the layer.datasource. What's the problem.

Thanks in Advance.