Show / Hide Table of Contents

Class Polygon

A multipart shape used to represent an area.

Inheritance
System.Object
Geometry
Multipart
Polygon
Multipart.Parts
Multipart.Extent
Multipart.IsEmpty
Multipart.HasZ
Multipart.HasM
Geometry.HasCurves
Geometry.IsNullOrEmpty(Geometry)
Geometry.SpatialReference
Geometry.ToJson()
Geometry.FromJson(String)
Geometry.FromJson(String, SpatialReference)
Geometry.Equals(Geometry, Double)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Esri.ArcGISRuntime.Geometry
Assembly: Esri.ArcGISRuntime.dll
Syntax
public class Polygon : Multipart
Remarks

Polygon geometries represent the shape and location of areas, for example, a country, island, or a lake. A polygon can be used as the geometry of features and graphics, or as input or output of tasks or geoprocessing operations, such as the output of a drive-time analysis or a Buffer(Geometry, Double) operation.

Each part of a multipart polygon is a series of connected Segment objects forming a closed ring. Each part must not cross any other part, but may lie completely inside or outside another part. For example, a polygon representing the state of Hawaii would comprise eight disjoint parts, one representing each island. A polygon representing the country of South Africa, which completely surrounds the enclave of Lesotho, would comprise two parts, one contained inside the other.

Polygon is similar to Polyline in that they are both composed of a series of connected segments. Like Polyline, the polygon class is a Multipart, which provides members for iterating the segments and points of each part in a polygon. Unlike parts in a Polyline, however, each part of a polygon defines a closed area, so the end map point of the last segment in the part is always in the same location as the start map point of the first segment, forming a closed boundary.

When defining a polygon part, there is no need to explicitly close it by repeating the start map point as the last map point. Polygons parts are always interpreted as enclosed areas by this API. However, you may need to simplify a polygon created with this API before storing it in a geodatabase or using it in geometry operations that rely on topological consistency.

Interior rings to make donut polygons should be counter-clockwise in direction to have the correct topology.

If there is ever a doubt about the topological correctness of a polygon, call the Simplify(Geometry) method to correct any issues. This is especially true if you pass a polygon to ArcGIS Server for a geoprocessing task to avoid any ArcGIS Server errors being thrown or to rectify polygons that may be self-intersecting, have rings which are partially contained in each other, or contain incorrect ring orientations.

Polygons are based upon the parent Geometry class. The geometry object is immutable which means that you can not change its shape once it is created. If you need to create a new polygon or modify it once it has been created, use the PolygonBuilder class.

A polygon can be used as the geometry of a Feature or Graphic. To obtain the geometry on these objects, use Geometry.

Constructors

Name Description
Polygon(IEnumerable<MapPoint>)

Initializes a new instance of the Polygon class.

Polygon(IEnumerable<MapPoint>, SpatialReference)

Initializes a new instance of the Polygon class.

Polygon(IEnumerable<Segment>)

Initializes a new instance of the Polygon class.

Polygon(IEnumerable<Segment>, SpatialReference)

Initializes a new instance of the Polygon class.

Polygon(IEnumerable<IEnumerable<MapPoint>>)

Initializes a new instance of the Polygon class.

Polygon(IEnumerable<IEnumerable<MapPoint>>, SpatialReference)

Initializes a new instance of the Polygon class.

Polygon(IEnumerable<IEnumerable<Segment>>)

Initializes a new instance of the Polygon class.

Polygon(IEnumerable<IEnumerable<Segment>>, SpatialReference)

Initializes a new instance of the Polygon class.

Properties

Name Description
Dimension

Gets a number that describes the dimensionality of a geometry.

GeometryType

Gets the geometry type.

Methods

Name Description
IsEqual(Geometry)

Compares two Polygon for equality. This will check for a matching SpatialReference and the content of Parts match. The order of parts must match too.

ToPolyline()

Returns a Polyline representation of this polygon.

ToString()

Returns a System.String that represents the current System.Object.

Extension Methods

GeometryEngine.NormalizeCentralMeridian(Geometry)
GeometryEngine.NearestVertex(Geometry, MapPoint)
GeometryEngine.NearestCoordinate(Geometry, MapPoint)
GeometryEngine.NearestCoordinateGeodetic(Geometry, MapPoint, Double, LinearUnit)
GeometryEngine.Project(Geometry, SpatialReference)
GeometryEngine.Project(Geometry, SpatialReference, DatumTransformation)
GeometryEngine.Union(Geometry, Geometry)
GeometryEngine.Intersection(Geometry, Geometry)
GeometryEngine.Intersections(Geometry, Geometry)
GeometryEngine.Clip(Geometry, Envelope)
GeometryEngine.Simplify(Geometry)
GeometryEngine.Area(Geometry)
GeometryEngine.AreaGeodetic(Geometry, AreaUnit, GeodeticCurveType)
GeometryEngine.Cut(Geometry, Polyline)
GeometryEngine.Length(Geometry)
GeometryEngine.LengthGeodetic(Geometry, LinearUnit, GeodeticCurveType)
GeometryEngine.Buffer(Geometry, Double)
GeometryEngine.Distance(Geometry, Geometry)
GeometryEngine.Intersects(Geometry, Geometry)
GeometryEngine.Contains(Geometry, Geometry)
GeometryEngine.Overlaps(Geometry, Geometry)
GeometryEngine.Within(Geometry, Geometry)
GeometryEngine.Crosses(Geometry, Geometry)
GeometryEngine.Disjoint(Geometry, Geometry)
GeometryEngine.Touches(Geometry, Geometry)
GeometryEngine.LabelPoint(Polygon)
GeometryEngine.Densify(Geometry, Double)
GeometryEngine.Offset(Geometry, Double, OffsetType, Double, Double)
GeometryEngine.Generalize(Geometry, Double, Boolean)
GeometryEngine.Difference(Geometry, Geometry)
GeometryEngine.SymmetricDifference(Geometry, Geometry)
GeometryEngine.DensifyGeodetic(Geometry, Double, LinearUnit, GeodeticCurveType)
GeometryEngine.ConvexHull(Geometry)
GeometryEngine.Relate(Geometry, Geometry, String)
GeometryEngine.BufferGeodetic(Geometry, Double, LinearUnit, Double, GeodeticCurveType)
GeometryEngine.Boundary(Geometry)
GeometryEngine.Reshape(Multipart, Polyline)
GeometryEngine.IsSimple(Geometry)
GeometryEngine.CombineExtents(Geometry, Geometry)
GeometryEngine.RemoveM(Geometry)
GeometryEngine.RemoveZ(Geometry)
GeometryEngine.RemoveZAndM(Geometry)
GeometryEngine.Move(Geometry, Double, Double)
GeometryEngine.Rotate(Geometry, Double, MapPoint)
GeometryEngine.Scale(Geometry, Double, Double, MapPoint)
GeometryExtensions.WithZ<T>(T, Double)
GeometryExtensions.WithM<T>(T, Double)
GeometryExtensions.WithZAndM<T>(T, Double, Double)

Applies to

TargetVersions
.NET Standard 2.0100.3 - 200.7
.NET100.13 - 200.7
.NET Windows100.13 - 200.7
.NET Android200.0 - 200.7
.NET iOS200.0 - 200.7
.NET Framework100.0 - 200.7
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.7

Relevant samples

Add graphics with symbols: Use a symbol style to display a graphic on a graphics overlay.
Buffer list: Generate multiple individual buffers or a single unioned buffer around multiple points.
Change viewpoint: Set the map view to a new viewpoint.
Convex hull list: Generate convex hull polygon(s) from multiple input geometries.
In This Article
Back to top Copyright © 2022 Esri.