IFeatureLayer pFeLayer = axMapControl1.get_Layer(0) as IFeatureLayer;
IDataLayer idata = pFeLayer as IDataLayer;
IDatasetName idataname = idata.DataSourceName as IDatasetName;
string path = idataname.WorkspaceName.PathName;
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
gp.SetEnvironmentValue("workspace", path);
CollectEvents collect = new CollectEvents(); collect.Input_Incident_Features = pFeLayer.FeatureClass;
collect.Output_Weighted_Point_Feature_Class = @"E:\collect.shp";
collect.Z_Max_Value = 10;
gp.Execute(collect, null);[/code]在最后一句出错,
尝试读取或写入受保护的内存,这通常指示其他内存已损坏
尝试把输入输出放到一个里面出错,尝试把输入换成全路径出错,尝试把workspace的设置放到输入输出下面出错,license的属性里面也打了对勾还是出错,求高手帮助,这些代码就在一个工程里,帮我调试一下吧,已经纠结了好长时间了,求帮助帮助啊!!
3 个解决方案
#1
代码:
IFeatureLayer pFeLayer = axMapControl1.get_Layer(0) as IFeatureLayer;
IDataLayer idata = pFeLayer as IDataLayer;
IDatasetName idataname = idata.DataSourceName as IDatasetName;
string path = idataname.WorkspaceName.PathName;
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
gp.SetEnvironmentValue("workspace", path);
CollectEvents collect = new CollectEvents(); collect.Input_Incident_Features = pFeLayer.FeatureClass;
collect.Output_Weighted_Point_Feature_Class = @"E:\collect.shp";
collect.Z_Max_Value = 10;
gp.Execute(collect, null)
IFeatureLayer pFeLayer = axMapControl1.get_Layer(0) as IFeatureLayer;
IDataLayer idata = pFeLayer as IDataLayer;
IDatasetName idataname = idata.DataSourceName as IDatasetName;
string path = idataname.WorkspaceName.PathName;
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
gp.SetEnvironmentValue("workspace", path);
CollectEvents collect = new CollectEvents(); collect.Input_Incident_Features = pFeLayer.FeatureClass;
collect.Output_Weighted_Point_Feature_Class = @"E:\collect.shp";
collect.Z_Max_Value = 10;
gp.Execute(collect, null)
#2
为什么我发的帖子就没有回复过呢???
#3
没看明白你的问题。
#1
代码:
IFeatureLayer pFeLayer = axMapControl1.get_Layer(0) as IFeatureLayer;
IDataLayer idata = pFeLayer as IDataLayer;
IDatasetName idataname = idata.DataSourceName as IDatasetName;
string path = idataname.WorkspaceName.PathName;
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
gp.SetEnvironmentValue("workspace", path);
CollectEvents collect = new CollectEvents(); collect.Input_Incident_Features = pFeLayer.FeatureClass;
collect.Output_Weighted_Point_Feature_Class = @"E:\collect.shp";
collect.Z_Max_Value = 10;
gp.Execute(collect, null)
IFeatureLayer pFeLayer = axMapControl1.get_Layer(0) as IFeatureLayer;
IDataLayer idata = pFeLayer as IDataLayer;
IDatasetName idataname = idata.DataSourceName as IDatasetName;
string path = idataname.WorkspaceName.PathName;
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
gp.SetEnvironmentValue("workspace", path);
CollectEvents collect = new CollectEvents(); collect.Input_Incident_Features = pFeLayer.FeatureClass;
collect.Output_Weighted_Point_Feature_Class = @"E:\collect.shp";
collect.Z_Max_Value = 10;
gp.Execute(collect, null)
#2
为什么我发的帖子就没有回复过呢???
#3
没看明白你的问题。