Private Function GetPolygonFeatureCentroid(ByVal PolygonFeatureLayer As IFeatureLayer) as IPoint Dim PolygonFeatureClass As IFeatureClass PolygonFeatureClass = PolygonFeatureLayer.FeatureClass Dim PolygonFeatureSelection As IFeatureSelection = PolygonFeatureLayer Dim PolygonFeatureSelectionSet As ISelectionSet = PolygonFeatureSelection.SelectionSet Dim PolygonFeatureCursor As IFeatureCursor Dim newPolygonFeature As IFeature Dim newPolygonArea As IArea Dim newPolygonFeatureCentroid As IPoint Dim queryFilter As IQueryFilter = New QueryFilterClass() 'ToDo: Setup the where clause here to select the feature that you want... or skip altogether if you already have that feature! PolygonFeatureFSelectionSet = PolygonFeatureClass.Select(queryFilter, esriSelectionType.esriSelectionTypeSnapshot, esriSelectionOption.esriSelectionOptionNormal, Nothing) PolygonFeatureCursor = PolygonFeatureClass.Search(queryFilter, False) If PolygonFeatureFSelectionSet.Count > 0 Then newPolygonFeature = PolygonFeatureFCursor.NextFeature newPolygonArea = newPolygonFeature.ShapeCopy newPolygonFeatureCentroid = TryCast(newPolygonArea.Centroid, IPoint) End If Return newPolygonFeatureCentroid End Function
Hi all,I am looking for asamples that shwo how to find a polygon centroid in C# or vb.netthanks
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.