Gis编程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:codeSharpMapDemoSharpmapDemoApp_datavn_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:codeSharpMapDemoSharpmapDemoApp_Data5tinh_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是唯一的。任何帮助都是感激的。谢谢你的阅读,并为我糟糕的英语感到抱歉。

试试下面的半透明图层

// 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);

最新更新