I have a polyline and I want to convert it to a single polygon feature, I used this code but I get error while I can convert the same shapefile using feature to polygon on ArcGIS. Where is my mistake?
ESRI.ArcGIS.DataManagementTools.FeatureToPolygon ftp = new ESRI.ArcGIS.DataManagementTools.FeatureToPolygon(path + "lines.shp", path + "polygons.shp");
ftp.attributes = "NO_ATTRIBUTES";
GP.Execute(ftp, null);
The path is set to
string path= System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\temp\Conversations\";
and the error that raises is:
Error HRESULT E_FAIL has been returned from a call to a COM component.
I tried to change output path to
"E:/MASTER/Project/Semirom/file gis semirom/New Folder/gisiran.gdb/tester"
But I get the same error... Do you think I must set Environment workspace or something like that? I also use:
ESRI.ArcGIS.ConversionTools.GPXtoFeatures
and ESRI.ArcGIS.DataManagementTools.PointsToLine(path + "points.shp", path + "lines.shp");
with the same settings and they works fine..:(
Is there any better approach to create a polygon?