小编Kho*_* Le的帖子

用SharpMap编程的Gis.最后一层涵盖其他层

我刚刚开始使用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);
Run Code Online (Sandbox Code Playgroud)

所以layCountry是我唯一看到的人.当我将最后两行更改为:

map.Layers.Add(layCountry);
map.Layers.Add(newLay);
Run Code Online (Sandbox Code Playgroud)

newLay是唯一的一个.任何帮助都很感激.感谢您阅读此内容并抱歉我的英语不好.

c# shapefile sharpmap

2
推荐指数
1
解决办法
4651
查看次数

标签 统计

c# ×1

shapefile ×1

sharpmap ×1