I would like to know a good way to return the center point of a polygon with the arcgispro sdk.
Thanks
Mike
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); }); }
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.