I would like to know a good way to return the center point of a polygon with the arcgispro sdk.
Thanks
Mike
Solved! Go to Solution.
Mike,
The labelpoint method on the GeometryEngine class should do it.
The following code will find the labelpoint for the first selected feature.
protected override void OnClick() { //Run on MCT ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { //get the labelpoint for the first selected feature var selectedFeatures = ArcGIS.Desktop.Mapping.MapView.Active.Map.GetSelection(); //load into editors inspector to get the shape geometry var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector(); insp.Load(selectedFeatures.First().Key, selectedFeatures.First().Value.First()); var selGeom = insp.Shape; var labelPoint = ArcGIS.Core.Geometry.GeometryEngine.LabelPoint(selGeom); }); }
Mike,
The labelpoint method on the GeometryEngine class should do it.
The following code will find the labelpoint for the first selected feature.
protected override void OnClick() { //Run on MCT ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { //get the labelpoint for the first selected feature var selectedFeatures = ArcGIS.Desktop.Mapping.MapView.Active.Map.GetSelection(); //load into editors inspector to get the shape geometry var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector(); insp.Load(selectedFeatures.First().Key, selectedFeatures.First().Value.First()); var selGeom = insp.Shape; var labelPoint = ArcGIS.Core.Geometry.GeometryEngine.LabelPoint(selGeom); }); }