Parameters
- geometry
- The input geometry.
Return Value
Area of the geometry in square meters.
Exception | Description |
---|---|
System.ArgumentNullException | Geometry is null or empty. |
System.NotImplementedException | The method is not implemented for GeometryBag or Multipatch. |
ProjectionEngineException | Geometry is missing a spatial reference. |
System.NotImplementedException | Spatial reference of geometryis an image coordinate system. |
// pt MapPoint pt = MapPointBuilder.CreateMapPoint(1.0, 3.0, SpatialReferences.WebMercator); double area = GeometryEngine.Instance.ShapePreservingArea(pt); // area = 0 List<MapPoint> pts = new List<MapPoint>(); pts.Add(MapPointBuilder.CreateMapPoint(1.0, 1.0, 3.0)); pts.Add(MapPointBuilder.CreateMapPoint(1.0, 3.0, 3.0)); pts.Add(MapPointBuilder.CreateMapPoint(3, 3, 3.0)); pts.Add(MapPointBuilder.CreateMapPoint(3.0, 1.0, 3.0)); // multipoint Multipoint mPt = MultipointBuilder.CreateMultipoint(pts); area = GeometryEngine.Instance.ShapePreservingArea(mPt); // area = 0 // polyline Polyline polyline = PolylineBuilder.CreatePolyline(pts); area = GeometryEngine.Instance.ShapePreservingArea(polyline); // area = 0 // polygon Polygon polygon = PolygonBuilder.CreatePolygon(pts, SpatialReferences.WGS84); area = GeometryEngine.Instance.ShapePreservingArea(polygon); polygon = PolygonBuilder.CreatePolygon(pts, SpatialReferences.WebMercator); area = GeometryEngine.Instance.ShapePreservingArea(polygon);
Target Platforms: Windows 10, Windows 8.1