Hi all,
I have a feature layer why contains a feature class, wich containes features, whose shapes are polygons and I want to convert these polygons into lines/polylines.
I found the tool DataManagementTools.PolygonToLine wich seems the adequate one to do the job but my code (in VB.Net) doesn't work.
Here it is (a bit simplified, I just give waht is useful in my opinion):
Dim pNewFeatureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass
Dim pFeatureCursor As ESRI.ArcGIS.Geodatabase.IFeatureCursor
pNewFeatureClass = AddFeatureClass(pFeatureWorkspace, strFeatureDatasetName, ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryLine, sFeatureClassName)
pFeatureCursor = pFeatureClass.Search(Nothing, False)
pFeature = pFeatureCursor.NextFeature
While (Not pFeature Is Nothing)
Dim pConvertTool As ESRI.ArcGIS.DataManagementTools.PolygonToLine
Dim OutLine As ESRI.ArcGIS.Geometry.Line
Dim pNewFeatureBuffer As ESRI.ArcGIS.Geodatabase.IFeatureClass
Dim pLine As ESRI.ArcGIS.Geometry.IGeometry
OutLine = New ESRI.ArcGIS.Geometry.Line
pConvertTool = New DataManagementTools.PolygonToLine(pFeature.Shape, OutLine)
' ---- Add the closed line to the new FeatureClass as a Polygon, copying the attributes.
pLline = pConvertTool.out_feature_class
' ---- Create a featurebuffer in the output feature class
pNewFeatureBuffer = pNewFeatureClass.CreateFeatureBuffer
' ---- Copy the shape to the feature buffer
pNewFeatureBuffer.Shape = pLine
I have an error at the line: pNewFeatureBuffer.Shape = pLine although pLine is filled whot a LineClass whose geometry type seems to be a line as defined for the pNewFeatureBuffer.Shape.
I tried different things, and the error in the different cases is "this type of geometry is not considered" (translated freely from french) or a memory error.
Thanks for help.