使用 SharpMap 进行地理信息系统编程。最后一层覆盖其他层
我刚刚开始接触 GIS 编程。我想建立一个简单的网站,上面有地图。因此,我选择 C# 和 SharpMap 作为地图库。一切工作正常,直到我从形状文件添加许多层。我添加的最后一层是我看到的唯一一层。 这是我的代码的一部分:
SharpMap.Map map = new SharpMap.Map(outputsize);
SharpMap.Layers.VectorLayer layCountry = new SharpMap.Layers.VectorLayer("nuoc");
layCountry.DataSource = new SharpMap.Data.Providers.ShapeFile(@"D:\code\SharpMapDemo\SharpmapDemo\App_data\vn_tinh_region.shp", false);
layCountry.Style.Fill = new SolidBrush(Color.Yellow);
layCountry.Style.Outline = new Pen(Color.Black, 1);
layCountry.Enabled = true;
layCountry.Style.EnableOutline = true;
SharpMap.Layers.VectorLayer newLay = new SharpMap.Layers.VectorLayer("tinh");
newLay.DataSource = new SharpMap.Data.Providers.ShapeFile(@"D:\code\SharpMapDemo\SharpmapDemo\App_Data\5tinh_region.shp", false);
newLay.Style.Fill = new SolidBrush(Color.Red);
newLay.Style.Outline = new Pen(Color.Black, 1);
newLay.Style.EnableOutline = true;
map.Layers.Add(newLay);
map.Layers.Add(layCountry);
因此,layCountry 是我看到的唯一一个。 当我将最后两行更改为:
map.Layers.Add(layCountry);
map.Layers.Add(newLay);
newLay 是唯一的。 任何帮助都是值得赞赏的。感谢您阅读本文,并对我的英语不好表示歉意。
I'm just started with GIS programming. I want to build a simple website with a map on it. So, I choose C# and SharpMap as map lib. Everything works fine, until I add many layers from shape file. The last layer I add is the only one layer I see.
This is part of my code:
SharpMap.Map map = new SharpMap.Map(outputsize);
SharpMap.Layers.VectorLayer layCountry = new SharpMap.Layers.VectorLayer("nuoc");
layCountry.DataSource = new SharpMap.Data.Providers.ShapeFile(@"D:\code\SharpMapDemo\SharpmapDemo\App_data\vn_tinh_region.shp", false);
layCountry.Style.Fill = new SolidBrush(Color.Yellow);
layCountry.Style.Outline = new Pen(Color.Black, 1);
layCountry.Enabled = true;
layCountry.Style.EnableOutline = true;
SharpMap.Layers.VectorLayer newLay = new SharpMap.Layers.VectorLayer("tinh");
newLay.DataSource = new SharpMap.Data.Providers.ShapeFile(@"D:\code\SharpMapDemo\SharpmapDemo\App_Data\5tinh_region.shp", false);
newLay.Style.Fill = new SolidBrush(Color.Red);
newLay.Style.Outline = new Pen(Color.Black, 1);
newLay.Style.EnableOutline = true;
map.Layers.Add(newLay);
map.Layers.Add(layCountry);
So layCountry is the only one I see.
When I change the two last line to:
map.Layers.Add(layCountry);
map.Layers.Add(newLay);
newLay is the only one.
Any help is appreciate. Thanks for reading this and sorry for my bad English.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试如下半透明层
Try semi transparent layer as below