使用 SharpMap 进行地理信息系统编程。最后一层覆盖其他层

发布于 2024-11-19 23:26:41 字数 1271 浏览 1 评论 0原文

我刚刚开始接触 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情感失落者 2024-11-26 23:26:41

尝试如下半透明层

// Set up Plate Layer
SharpMap.Layers.VectorLayer PlateLayer = new SharpMap.Layers.VectorLayer("PlateLayer");        
PlateLayer.DataSource = new SharpMap.Data.Providers.ShapeFile(LayerPath + Region + "_plates.shp", false);
Color c = Color.FromArgb(30, 100, 100, 100);
Brush b = new SolidBrush(c);
PlateLayer.Style.Fill = b;
PlateLayer.Style.Outline = new Pen(Color.LightGray, 1);
PlateLayer.Style.EnableOutline = true;
MainMap.Layers.Add(PlateLayer);

Try semi transparent layer as below

// Set up Plate Layer
SharpMap.Layers.VectorLayer PlateLayer = new SharpMap.Layers.VectorLayer("PlateLayer");        
PlateLayer.DataSource = new SharpMap.Data.Providers.ShapeFile(LayerPath + Region + "_plates.shp", false);
Color c = Color.FromArgb(30, 100, 100, 100);
Brush b = new SolidBrush(c);
PlateLayer.Style.Fill = b;
PlateLayer.Style.Outline = new Pen(Color.LightGray, 1);
PlateLayer.Style.EnableOutline = true;
MainMap.Layers.Add(PlateLayer);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文