Road Layer

Road Layer 
Tags: General Topics

Aug 30 2006 at 2:08 PM
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 2:49 PM
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 5:42 PM
Thank you very much

Mar 2 2007 at 3:50 AM
Edited Mar 2 2007 at 5:58 AM
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.

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值