public double ShapePreservingLength( Geometry geometry, LinearUnit lengthUnit )
Public Overloads Function ShapePreservingLength( _ ByVal geometry As Geometry, _ ByVal lengthUnit As LinearUnit _ ) As Double
Parameters
- geometry
- lengthUnit
public double ShapePreservingLength( Geometry geometry, LinearUnit lengthUnit )
Public Overloads Function ShapePreservingLength( _ ByVal geometry As Geometry, _ ByVal lengthUnit As LinearUnit _ ) As Double
// pt MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 3.0, SpatialReferences.WebMercator); double len = GeometryEngine.Instance.ShapePreservingLength(pt); // len = 0 List<MapPoint> pts = new List<MapPoint>(); pts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0, 3.0)); pts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 3.0, 3.0)); pts.Add(MapPointBuilderEx.CreateMapPoint(3, 3, 3.0)); pts.Add(MapPointBuilderEx.CreateMapPoint(3.0, 1.0, 3.0)); // multipoint Multipoint mPt = MultipointBuilderEx.CreateMultipoint(pts); len = GeometryEngine.Instance.ShapePreservingLength(mPt); // len = 0 // polyline Polyline polyline = PolylineBuilderEx.CreatePolyline(pts, SpatialReferences.WGS84); len = GeometryEngine.Instance.ShapePreservingLength(polyline); // polygon Polygon polygon = PolygonBuilderEx.CreatePolygon(pts, SpatialReferences.WGS84); len = GeometryEngine.Instance.ShapePreservingLength(polygon); polyline = PolylineBuilderEx.CreatePolyline(new[] { MapPointBuilderEx.CreateMapPoint( -170, 0), MapPointBuilderEx.CreateMapPoint( 170, 0) }, SpatialReferences.WGS84); var length_meters = GeometryEngine.Instance.ShapePreservingLength(polyline); // , LinearUnits.Meters); var length_miles = GeometryEngine.Instance.ShapePreservingLength(polyline, LinearUnit.Miles); // length_meters - 37848626.869713023 // length_miles - 23518.046402579574
Target Platforms: Windows 11, Windows 10