Road Layer

Topics: General Topics
Aug 30, 2006 at 6:08 AM
Can anyone please tell me how to make the Road Layers look like the one in the "Citymap Screenshot". It would be a great help to me.

Regards,
Vijaysudh
Developer
Aug 30, 2006 at 6:49 AM
I think the code below is the one I used for that. The data was already divided into 3 road-classes (roads 3-6m, roads 6+ m and various roads):

SharpMap.Layers.VectorLayer layRoad36m = new SharpMap.Layers.VectorLayer("road 36m");
layRoad36m.DataSource = new SharpMap.Data.Providers.PostGIS(ConnStr, "road36m_polyline", "gid");
layRoad36m.Style.Outline = new Pen(Color.Black, 1);
layRoad36m.Style.Line.Width = 6;
layRoad36m.Style.Line.Color = Color.FromArgb(255, 198, 64);
layRoad36m.Style.Line.EndCap = System.Drawing.Drawing2D.LineCap.Round;
layRoad36m.Style.Line.StartCap = layRoad36m.Style.Line.EndCap;
layRoad36m.Style.Outline = (System.Drawing.Pen)layRoad36m.Style.Line.Clone();
layRoad36m.Style.Outline.Width += 1.5f;
layRoad36m.Style.Outline.Color = Color.Black;
layRoad36m.Style.EnableOutline = false;
layRoad36m.MaxVisible = 10000;

SharpMap.Layers.VectorLayer layRoad6m = new SharpMap.Layers.VectorLayer("road 6m");
layRoad6m.DataSource = new SharpMap.Data.Providers.PostGIS(ConnStr, "road6m_polyline", "gid");
layRoad6m.Style.Outline = new Pen(Color.Black, 1);
layRoad6m.Style.Line.Width = 8;
layRoad6m.Style.Line.Color = layRoad36m.Style.Line.Color;
layRoad6m.Style.Line.EndCap = System.Drawing.Drawing2D.LineCap.Round;
layRoad6m.Style.Line.StartCap = layRoad6m.Style.Line.EndCap;
layRoad6m.Style.Outline = (System.Drawing.Pen)layRoad6m.Style.Line.Clone();
layRoad6m.Style.Outline.Width += 1.5f;
layRoad6m.Style.Outline.Color = Color.Black;
layRoad6m.Style.EnableOutline = false;
layRoad6m.MaxVisible = 5000;

SharpMap.Layers.VectorLayer layRoadOther = new SharpMap.Layers.VectorLayer("road various");
layRoadOther.DataSource = new SharpMap.Data.Providers.PostGIS(ConnStr, "roadand_polyline", "gid");
layRoadOther.Style.Outline = new Pen(Color.Black, 1);
layRoadOther.Style.Line.Width = 4;
layRoadOther.Style.Line.Color = layRoad36m.Style.Line.Color;
layRoadOther.Style.Line.EndCap = System.Drawing.Drawing2D.LineCap.Round;
layRoadOther.Style.Line.StartCap = layRoadOther.Style.Line.EndCap;
layRoadOther.Style.Outline = (System.Drawing.Pen)layRoadOther.Style.Line.Clone();
layRoadOther.Style.Outline.Width += 1.5f;
layRoadOther.Style.Outline.Color = Color.Black;
layRoadOther.Style.EnableOutline = false;
layRoadOther.MaxVisible = 2000;
Sep 4, 2006 at 9:42 AM
Thank you very much
Mar 1, 2007 at 6:50 PM
Edited Mar 1, 2007 at 8:58 PM
Hi!

I've tried to a simmilar effect but failed. Even verbatim copy of the code above(which seems a bit inconsistent) fails.

UPDATE:
When using outline in thematics you need to set EnableOutline = true to the main layer style and not min and max gradient styles.

Goran