Programmatically check if FeatureClass accepts Multipart geometries

742
5
Jump to solution
06-27-2012 10:01 AM
DiegoIvan_Ordonez
New Contributor
Hi.

I'm inserting geometries into a FeatureClass that doesn't support Multipart and it send an Exception, "not supported shape"

I would like to know if a FeatureClass supports or not Multipart before inserting to correctly handle the Exception.

Thanks !
0 Kudos
1 Solution

Accepted Solutions
NeilClemmons
Regular Contributor III
There's no such thing as a feature class that doesn't accept multi-part geometries, with the exception of a Point feature class (IPoint geometries cannot have more than one point).  Please reread my post.  Perhaps you should post your code and show what you're trying to do.

View solution in original post

0 Kudos
5 Replies
NeilClemmons
Regular Contributor III
That isn't entirely accurate.  The problem isn't that the geometry is multi-part; it's that the geometry type is incorrect.  For example, if the feature class is a Polyline class then you can insert any geometry as long as it implements IPolyline.  It doesn't matter how many segments the polyline contains or if the segments are not all connected (i.e. it's a multi-part polyline).  You can't, however, insert a Line, EllipticArc, CircularArc, or one of the other line type geometries.  It has to be IPolyline.

You can check the geometry type expected by the feature class via IFeatureClass.ShapeType.  Here is a breakdown of some common scenarios:

esriGeometryPoint - geometry must implement IPoint
esriGeometryMultiPoint - geometry must implement IMultiPoint
esriGeometryPolyline - geometry must implement IPolyline
esriGeometryPolygon - geometry must implement IPolygon
0 Kudos
DiegoIvan_Ordonez
New Contributor
Thanks for your rapid response.

But anyway i would like to know how to check if a FeatureClass accepts or not Multi-part features.
0 Kudos
NeilClemmons
Regular Contributor III
There's no such thing as a feature class that doesn't accept multi-part geometries, with the exception of a Point feature class (IPoint geometries cannot have more than one point).  Please reread my post.  Perhaps you should post your code and show what you're trying to do.
0 Kudos
DiegoIvan_Ordonez
New Contributor
I have a FeatureClass having "Line" shape column called REFERENCE_L

I'm inserting the boundaries of a Polygon feature Class (HYDRO_AREA) into that Feature Class REFERENCE_L and everything goes well until i get one Multipart feature.

I detect this multipart feature within this sentence:

          If (CType(_itfFeatrSourc.ShapeCopy, IGeometryCollection).GeometryCount > 1) Then
                Dim esritype1 As esriGeometryType = _itfFeatrSourc.Shape.GeometryType
                ' It is Multipart
          End If


the esritype1 variable gets the value : esriGeometryPolygon {4}

After that i get the boundary of the polygon using the ITopologicalOperator.Boundary and it returns an esriGeometryPolyline {3}, but when i try to insert that into the Line FeatureClass it send the message:

"Shapes of this entity type not allowed in this layer [SHAPE]"


Any suggestion ?

Thank you very much.

Diego
0 Kudos
NeilClemmons
Regular Contributor III
Without seeing your code there's not much I can do.  Be sure to use the CODE tags when posting your code (the # button on the toolbar) so that it formats correctly and is easier to read.
0 Kudos