laptop and a wrench

Bogue

Cannot import vertical multipatches into SDE.

Dernière publication: August 25, 2014 No Product Found
Numéro d’ID de bogue NIM011541
EnvoiSeptember 10, 2007
Dernière modificationApril 2, 2025
S’applique àNo Product Found
Version trouvée9.2
Version de correction9.3
StatutFixed

Solution de contournement

Use the following code:Option Explicit' Use to ensure multipatch footprints are 'simple' relative to target spatial referencePublic Sub FileMultiPatchToSDE() On Error GoTo EH ' First layer in doc contains input multipatch feature class ' Second layer is target SDE multipatch feature class. You can make the FC with ArcCatalog ' (an empty FC with the proper spatial reference) then place it in the doc. Dim pDoc As IMxDocument Set pDoc = ThisDocument ' Get input Dim pFL As IFeatureLayer Set pFL = pDoc.ActiveView.FocusMap.Layer(0) Dim pInFC As IFeatureClass Set pInFC = pFL.FeatureClass Dim pInFCur As IFeatureCursor Set pInFCur = pInFC.Search(Nothing, True) Dim pInF As IFeature Set pInF = pInFCur.NextFeature ' Get output - assumed to reside in SDE feature dataset Set pFL = pDoc.ActiveView.FocusMap.Layer(1) Dim pOutFC As IFeatureClass Set pOutFC = pFL.FeatureClass Dim pWE As IWorkspaceEdit If (pOutFC.FeatureDataset Is Nothing) Then Dim pDS As IDataset Set pDS = pOutFC Set pWE = pDS.Workspace Else Set pWE = pOutFC.FeatureDataset.Workspace End If pWE.StartEditing False pWE.StartEditOperation Dim pOutGDS As IGeoDataset Set pOutGDS = pOutFC Dim pSR As ISpatialReference Set pSR = pOutGDS.SpatialReference Dim pOutCursor As IFeatureCursor Set pOutCursor = pOutFC.Insert(True) Dim pOutBuffer As IFeatureBuffer Set pOutBuffer = pOutFC.CreateFeatureBuffer Do While (Not pInF Is Nothing) ' Get the shape Dim pMP As IMultiPatch2 Set pMP = pInF.ShapeCopy ' Snap and simplify projected footprint relative to output spatial ref Dim pTransform As ITransform3D Set pTransform = pMP Dim pGeom As IGeometry Set pGeom = pTransform.ProjectToPlane(Nothing, Nothing, Nothing) Set pGeom.SpatialReference = pSR pGeom.SnapToSpatialReference Dim pTopo As ITopologicalOperator2 Set pTopo = pGeom pTopo.IsKnownSimple = False pTopo.Simplify ' Check if simplify was able to generate a clean footprint. If not (e.g., feature with ' no 2D area, like a vertical cylinder with no top and bottom) use the 2D bounding box ' as the footprint. For completeness, this test should also check for an axis aligned ' vertical feature (e.g., wall) that would yield a 0 area envelope. That would be another ' special case. Dim pGC As IGeometryCollection Set pGC = pTopo If (pGC.GeometryCount = 0) Then Set pGeom = pMP Set pMP.XYFootprint = EnvelopeAsPoly(pGeom.Envelope) Else Set pMP.XYFootprint = pTopo End If Set pOutBuffer.Shape = pMP pOutCursor.InsertFeature pOutBuffer Set pInF = pInFCur.NextFeature Loop Set pOutBuffer = Nothing Set pOutCursor = Nothing pWE.StopEditOperation pWE.StopEditing True Exit SubEH: Debug.Print Err.DescriptionEnd SubPublic Function EnvelopeAsPoly(pEnvelope As IEnvelope) As IPolygon Dim xmin As Double, ymin As Double, xmax As Double, ymax As Double pEnvelope.QueryCoords xmin, ymin, xmax, ymax Dim pt As IPoint Dim pRing As IPointCollection Set pRing = New Ring Set pt = New esriGeometry.Point pt.X = xmin pt.Y = ymin pRing.AddPoint pt pt.Y = ymax pRing.AddPoint pt pt.X = xmax pRing.AddPoint pt pt.Y = ymin pRing.AddPoint pt pt.X = xmin pRing.AddPoint pt Dim pPoly As IGeometryCollection Set pPoly = New esriGeometry.Polygon pPoly.AddGeometry pRing Set EnvelopeAsPoly = pPolyEnd Function

Étapes pour reproduire

ID de bogue: NIM011541

Logiciel:

  • No Product Found

Recevoir une notification lorsque le statut d’un bogue change

Télécharger l’application Esri Support

En savoir plus sur ce sujet

Obtenir de l’aide auprès des experts ArcGIS

Contacter le support technique

Télécharger l’application Esri Support

Accéder aux options de téléchargement