This might be overkill, but here is a quick snapshot with slight modifications of some code that I use to get a centroid of a polygon feature... 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
I left out the specific where clause for the query filter used, I figured that you would have that already, or already have the particular feature that you want the centroid of...Hope this helps.Kevin OrcuttGIS Developer/ConsultantCity of Cincinnati - Cincinnati Area GIS (CAGIS)(513) 850-1335 (cell)Kevin.Orcutt@cincinnati-oh.govwww.cagis.org