如何在 C# 中的 EGIS 中添加形状文件?
How to add shape file at EGIS in c#?
我正在使用 EGIS 库,SfMap 工具属于 EGIS,但我无法打开或读取形状文件。
我尝试打开的文件名称是 roads.shp
.
在 AddShapeFile
它说我应该写:(string path,string name,string labelFieldName)
。我按照下面的方式写,但它给出了诸如 "ArgumentException was unhandled" 之类的错误。我该怎么办?
private void button1_Click(object sender, EventArgs e)
{
sfMap1.AddShapeFile(@"C:\Users\Quanthema\Desktop\Paylasim\Performance Test", "roads", "");
}
API documentation for SFMap.AddShapeFile
对参数的说明如下:
path Type: System..String The file path to the ShapeFile
name Type: System..String The "display" name of the ShapeFile.
labelFieldName Type: System..String The name of the field in the ShapeFiles's DBF
file to use when rendering the shape labels
你在哪里:
sfMap1.AddShapeFile(@"C:\Users\Quanthema\Desktop\Paylasim\Performance Test", "roads", "");
您似乎没有为第一个 path
参数提供完整的文件路径,而您在 "display" name
字段中提供了文件名。
尝试这样的事情:
sfMap1.AddShapeFile(@"C:\Users\Quanthema\Desktop\Paylasim\Performance Test\roads.shp", "ShapeFile", "");
从示例用法 here 看来您可以将空字符串作为第三个参数传递,所以我认为这不是问题所在。
我正在使用 EGIS 库,SfMap 工具属于 EGIS,但我无法打开或读取形状文件。
我尝试打开的文件名称是 roads.shp
.
在 AddShapeFile
它说我应该写:(string path,string name,string labelFieldName)
。我按照下面的方式写,但它给出了诸如 "ArgumentException was unhandled" 之类的错误。我该怎么办?
private void button1_Click(object sender, EventArgs e)
{
sfMap1.AddShapeFile(@"C:\Users\Quanthema\Desktop\Paylasim\Performance Test", "roads", "");
}
API documentation for SFMap.AddShapeFile
对参数的说明如下:
path Type: System..String The file path to the ShapeFile
name Type: System..String The "display" name of the ShapeFile.
labelFieldName Type: System..String The name of the field in the ShapeFiles's DBF file to use when rendering the shape labels
你在哪里:
sfMap1.AddShapeFile(@"C:\Users\Quanthema\Desktop\Paylasim\Performance Test", "roads", "");
您似乎没有为第一个 path
参数提供完整的文件路径,而您在 "display" name
字段中提供了文件名。
尝试这样的事情:
sfMap1.AddShapeFile(@"C:\Users\Quanthema\Desktop\Paylasim\Performance Test\roads.shp", "ShapeFile", "");
从示例用法 here 看来您可以将空字符串作为第三个参数传递,所以我认为这不是问题所在。