我刚刚开始学习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是唯一的一个。任何帮助都是非常感谢的。感谢你阅读这篇文章,并为我糟糕的英语感到抱歉。
发布于 2011-07-15 00:04:56
尝试半透明层,如下所示
// 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);https://stackoverflow.com/questions/6696169
复制相似问题