Assembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
Field Value
A double indicating the area of the Polygon.Remarks
For geometries with linear units (those with a projected coordinate system), the units of measurement of the Area property are square units of the CoordinateSystem of the geometry (Geometry.CoordinateSystem.Units).
Note: |
---|
Geometries with geographical coordinate systems have angular units. Square angular units are not a rational measurement; angular units vary according to their location on the earth, meaning the Area of two geometries at different locations in angular units would not be comparable. This API indicates this by throwing an exception. The GeodesicUtilities class offers helper methods to retrieve spatial properties such as Area by returning the value in a specified square linear unit. |
Examples
// Create a Polygon with a projected coordinate system. IEnumerable<ESRI.ArcGISExplorer.Geometry.Point> bngPoints = new ESRI.ArcGISExplorer.Geometry.Point[] { new ESRI.ArcGISExplorer.Geometry.Point(326872.482358681, 673940.581779784), new ESRI.ArcGISExplorer.Geometry.Point(326937.296501129, 673957.506541019), new ESRI.ArcGISExplorer.Geometry.Point(326953.836608697, 673895.000320552), new ESRI.ArcGISExplorer.Geometry.Point(326889.407119913, 673876.536944667), new ESRI.ArcGISExplorer.Geometry.Point(326887.099197928, 673887.307247264), new ESRI.ArcGISExplorer.Geometry.Point(326897.677173697, 673890.769130243), new ESRI.ArcGISExplorer.Geometry.Point(326884.791275943, 673934.23499432), new ESRI.ArcGISExplorer.Geometry.Point(326874.597953836, 673932.311725998), new ESRI.ArcGISExplorer.Geometry.Point(326872.482358681, 673940.581779784) }; Polygon bngPolygon = new Polygon(bngPoints, CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.Europe.BritishNationalGrid); // For geometries with projected coordinate systems, the Area can be retrieved directly. // British national grid uses Meters as its unit. double bngArea = bngPolygon.Area; // Project the polygon to create a geometry with a geographic coordinate system. Polygon wgs84Polygon = (Polygon)GeometryOperations.Project(bngPolygon, CoordinateSystem.GeographicCoordinateSystems.World.WGS1984, new GeographicTransformation(1195)); // Use GeodesicUtilities to get Area for a geometry with a geographic coordinate system, // which has angular units double wgs84Area = GeodesicUtilities.Area(wgs84Polygon, Unit.Area.SquareMeters);
' Create a Polygon with a projected coordinate system. Dim bngPoints As IEnumerable(Of ESRI.ArcGISExplorer.Geometry.Point) = New ESRI.ArcGISExplorer.Geometry.Point() { _ New ESRI.ArcGISExplorer.Geometry.Point(326872.482358681, 673940.581779784), _ New ESRI.ArcGISExplorer.Geometry.Point(326937.296501129, 673957.506541019), _ New ESRI.ArcGISExplorer.Geometry.Point(326953.836608697, 673895.000320552), _ New ESRI.ArcGISExplorer.Geometry.Point(326889.407119913, 673876.536944667), _ New ESRI.ArcGISExplorer.Geometry.Point(326887.099197928, 673887.307247264), _ New ESRI.ArcGISExplorer.Geometry.Point(326897.677173697, 673890.769130243), _ New ESRI.ArcGISExplorer.Geometry.Point(326884.791275943, 673934.23499432), _ New ESRI.ArcGISExplorer.Geometry.Point(326874.597953836, 673932.311725998), _ New ESRI.ArcGISExplorer.Geometry.Point(326872.482358681, 673940.581779784)} Dim bngPolygon As Polygon = New Polygon(bngPoints, _ CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.Europe.BritishNationalGrid) ' For geometries with projected coordinate systems, the Area can be retrieved directly. ' British national grid uses Meters as its unit. Dim bngArea As Double = bngPolygon.Area ' Project the polygon to create a geometry with a geographic coordinate system. Dim wgs84Polygon As Polygon = DirectCast(GeometryOperations.Project(bngPolygon, _ CoordinateSystem.GeographicCoordinateSystems.World.WGS1984, New GeographicTransformation(1195)), Polygon) ' Use GeodesicUtilities to get Area for a geometry with a geographic coordinate system, ' which has angular units Dim wgs84Area As Double = GeodesicUtilities.Area(wgs84Polygon, Unit.Area.SquareMeters)
Exceptions
Exception | Condition |
---|---|
System..::.NotSupportedException | Getting the Area of a Polygon in square angular units is not supported; try using the GeodesicUtilities class and specifying a square linear unit or measurement. |