ArcGIS Explorer Component Help |
GeodesicUtilities..::.Area Method (Envelope, Unit) |
GeodesicUtilities Class Example See Also |
Returns the geodesic area of an Envelope in the requested area units.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static double Area( Envelope envelope, Unit areaUnit ) |
Visual Basic (Declaration) |
---|
Public Shared Function Area ( _ envelope As Envelope, _ areaUnit As Unit _ ) As Double |
Parameters
- envelope
- Type: ESRI.ArcGISExplorer.Geometry..::.Envelope
The Envelope to measure.
- areaUnit
- Type: ESRI.ArcGISExplorer.Geometry..::.Unit
The area units of the returned measurement.
Return Value
The area, in areaUnit, of the envelope, measured geodesically.Remarks
Geodesic measurements account for the curvature of the earths surface.
Examples
The code below shows how the Area property can be used to retrieve the area of a Polygon with linear
units (a projected coordinate system). It also shows getting the area of a Polygon which has angular
units (a geographic coordinate system) by using the GeodesicUtilities class Area method to return the
area, specifying an area unit. Similar code can be applied to get the area of Envelopes.
CopyC#
// 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);
CopyVB.NET
' 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)