This project has moved and is read-only. For the latest updates, please go here.

Street Maps

Topics: General Topics
Sep 14, 2006 at 2:02 PM

I see in the examples some street maps but they have no road names.

Can this control display good quality street maps with road names?

What sources of data are available to do this?

Also, is it possible to add a breadcrumb trail type set of points to the map in real-time to plot movement over a map?

Many thanks

Sep 18, 2006 at 9:50 PM
It doesn't look like there's a way to label roads such that the label orients itself with the line (would someone correct me if I'm wrong?).

As far as bread crumbs ... this is certainly possible but you'd have to implement it yourself. You could do it one of two ways:

1. Have your tracked points be updated in a database. Any time a layer drawn from that database is refreshed it'll get the new points.
2. Do this in code using the GeometryProvider class.

Hope that helps. Good luck.
Sep 18, 2006 at 10:55 PM
You can create a new layer for labels. It's done like this (adapted from the source code example in LabelLayer.cs):

SharpMap.Layers.VectorLayer streets = new VectorLayer("Streets");
streetLabels.DataSource = new SharpMap.Data.Providers.ShapeFile(@"C:\data\streets.shp");
SharpMap.Layers.LabelLayer streetLabels = new SharpMap.Layers.LabelLayer("Street labels");
streetLabels.DataSource = streets.DataSource;
streetLabels.Enabled = true;
streetLabels.LabelColumn = "Name";
streetLabels.Style = new SharpMap.Styles.LabelStyle();
streetLabels.Style.CollisionDetection = true;
streetLabels.Style.CollisionBuffer = new SizeF(5, 5);
streetLabels.Style.ForeColor = Color.Black;
streetLabels.Style.Font = new Font(FontFamily.GenericSerif, 8);
streetLabels.MaxVisible = 90;
streetLabels.Style.HorizontalAlignment = SharpMap.Styles.LabelStyle.HorizontalAlignmentEnum.Right;
streetLabels.Style.VerticalAlignment = SharpMap.Styles.LabelStyle.VerticalAlignmentEnum.Top;
Sep 18, 2006 at 10:56 PM
The above will work unless what you mean by "orientation" is "conformal", where as the line bends, so does the label baseline?
Sep 19, 2006 at 2:49 PM
I am facing problems the following problems with labellayer in SharpMap.
1)No labels are visible even on a maximum zoom in..!

2) It doesn't accept parameters while creating a new LabelLayer as a result of which we defined it as follows:
SharpMap.Layers.LabelLayer layLabel = new SharpMap.Layers.LabelLayer();

3)Its not accepting Horizontal Alignment. Gives error on executing the following:
layLabel.Style.HorizontalAlignment = SharpMap.Styles.LabelStyle.HorizontalAlignmentEnum.Center;


Sep 28, 2006 at 9:53 AM
I added this line to make the labels...

SharpMap.Layers.LabelLayer shp = new SharpMap.Layers.LabelLayer(layerName);
shp.DataSource = new SharpMap.Data.Providers.ShapeFile(s);
shp.LabelColumn = "LABEL_COLUMN";
shp.RotationColumn = "LABEL_ROTATION";

However, the labels are not aligned properly. Any thoughts?
Sep 28, 2006 at 11:16 AM

I have the same problem!

I use the text_angle column of my table like this:

layer_streets.LabelColumn = "textstring";
layerstreets.RotationColumn = "textangle";

But the labels angle is not correct when i show them. With MapInfo everything is OK.

In the table under the text_angle column there are values like these:


I guess that the biggest number is 360.

Thanks if anyone have idea.

Sep 28, 2006 at 1:16 PM
I Found that RotationColumn accepts only int values like 65, 340, 230, 560 ans it doesn't accept float values like: 316.345, 23.00123

Am I right? Is it possible to solve this without truncating each values in the TEXT_ANGLE column of the actual table?


Sep 28, 2006 at 1:49 PM
I mean It accepst float value, but the alignment will be wrong.

Oct 1, 2008 at 9:20 AM

I have the same problem!

I use the rotation column of my table like this:

layCityLabel.LabelColumn =

layCityLabel.RotationColumn =


But the labels angle is not correct when i show them. 

Exists one solution for this problem???