首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用SharpMap进行Gis编程。最后一层覆盖了其他层

用SharpMap进行Gis编程。最后一层覆盖了其他层
EN

Stack Overflow用户
提问于 2011-07-14 23:55:01
回答 1查看 4.8K关注 0票数 2

我刚刚开始学习GIS编程。我想建立一个简单的网站上的地图。因此,我选择C#和SharpMap作为映射库。一切正常,直到我从形状文件中添加了许多层。我添加的最后一层是我看到的唯一一层。这是我的代码的一部分:

代码语言:javascript
复制
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是我唯一看到的。当我将最后两行改为:

代码语言:javascript
复制
map.Layers.Add(layCountry);
map.Layers.Add(newLay);

newLay是唯一的一个。任何帮助都是非常感谢的。感谢你阅读这篇文章,并为我糟糕的英语感到抱歉。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-07-15 00:04:56

尝试半透明层,如下所示

代码语言:javascript
复制
// 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);
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6696169

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档