get all points of polygon geometry

1145
1
Jump to solution
05-18-2021 04:53 AM
geopamplona
New Contributor III

Hello,

I am trying to get all points of a polygon geometry.

I can't get it to work.

I try:

Esri.ArcGISRuntime.Geometry.Polygon polygon = (Esri.ArcGISRuntime.Geometry.Polygon)Esri.ArcGISRuntime.Geometry.Geometry.FromJson(geoJson);

But Polygon do not has Rings property or similar to obtain point list.

Thanks !!

0 Kudos
1 Solution

Accepted Solutions
JoeHershman
MVP Regular Contributor

Polygons (and Polylines) are made up of collection of Parts.  So each ring will be a Part in the Part array

var polygon = (Polygon)Geometry.FromJson(polyJson);
foreach (var part in polygon.Parts)
{
   // do something with the part
   // part is an IEnumerable of segments
}

 

 

Thanks,
-Joe

View solution in original post

1 Reply
JoeHershman
MVP Regular Contributor

Polygons (and Polylines) are made up of collection of Parts.  So each ring will be a Part in the Part array

var polygon = (Polygon)Geometry.FromJson(polyJson);
foreach (var part in polygon.Parts)
{
   // do something with the part
   // part is an IEnumerable of segments
}

 

 

Thanks,
-Joe