Parameters
- geometry
- The input geometry.
Return Value
Length of the geometry in meters. If the geometry is empty, then zero is returned.
Exception | Description |
---|---|
System.ArgumentNullException | Geometry is null. |
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 len = GeometryEngine.Instance.ShapePreservingLength(pt); // len = 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); len = GeometryEngine.Instance.ShapePreservingLength(mPt); // len = 0 // polyline Polyline polyline = PolylineBuilder.CreatePolyline(pts, SpatialReferences.WGS84); len = GeometryEngine.Instance.ShapePreservingLength(polyline); // polygon Polygon polygon = PolygonBuilder.CreatePolygon(pts, SpatialReferences.WGS84); len = GeometryEngine.Instance.ShapePreservingLength(polygon);
Target Platforms: Windows 10, Windows 8.1