Select to view content in your preferred language

How to get non ZAware polygons into a ZAware polygon featureclass

2780
2
09-06-2011 07:41 AM
ChristineLarsen
Occasional Contributor
I've buffered a line feature class and need to get the resulting polygons into a ZAware feature class. My lines are ZAware, but the buffering seems to make non ZAware features, so I get an error trying to enter them into my ZAware feature class.
I've tried entering them into a non ZAware polygon feature class, which works fine, but then I get a problem trying to copy those into my ZAware polygon feature class.
The ZAware polygon feature class is an existing featureclass that is part of a data model, so it's not created by code, meaning that I can't just make a non ZAware polygon feature class instead.

The error messages that I get is either "No spatial reference exist" which is a misleading messages since it's got nothing to do with spatial reference, the other one is "The geometry has null Z values". It changes between these two error messages depending on wheter pZAware.ZAware = False or True.

Copying the non ZAware polygons into the ZAware polygon feature class in ArcMap works fine, so it's got to be possible doing it with ArcObjects as well.

Will be really grateful for some input on this!


[HTML]pFeatureCur = pLineFC.Search(Nothing, True)
        pLineFeat = pFeatureCur.NextFeature

        Do Until pLineFeat Is Nothing
            pPolyline = pLineFeat.Shape
            pTopo = pPolyline
            pPolygon = pTopo.Buffer(dBuffer)
            pPolyFeat = pSSDMFC.CreateFeature
            pZAware = pPolygon
            pZAware.ZAware = True
           
            pPolyFeat.Shape = pPolygon
            pPolyFeat.Store()
            pLineFeat = pFeatureCur.NextFeature
        Loop[/HTML]
0 Kudos
2 Replies
NeilClemmons
Honored Contributor
If the feature class is z-aware then the feature geometry must have z values.  You can do this several ways.  One way is to use a functional surface and use it to interpolate z values for the geometry.  You can also assign a z value of 0 (or another constant value) to each vertex point.  To do this, you just QI over to IZAware and set the ZAware property to True.  You then QI to IZ and call the SetConstantZ method.  You can also use one of the other IZ methods to set z values for the geometry if you like.

Also, the exact opposite is true.  If the feature class is NOT z-aware then the feature geometry cannot have z values.  In this case, you simply QI to IZAware, set ZAware to False and call the DropZs method.
0 Kudos
ChristineLarsen
Occasional Contributor
Thanks Neil! That worked 🙂

Christine
0 Kudos