Пример #1
0
        public static double SpatialDistanceBetweenPlaces(Wgs84Coordinates a, Wgs84Coordinates b)
        {
            var fablat = new DotSpatial.Positioning.Latitude((double)a.Latitude);
            var fablng = new DotSpatial.Positioning.Longitude((double)a.Longitude);

            var sglat = new DotSpatial.Positioning.Latitude((double)b.Latitude);
            var sglng = new DotSpatial.Positioning.Longitude((double)b.Longitude);

            var fab = new DotSpatial.Positioning.Position(fablat, fablng);
            var sg  = new DotSpatial.Positioning.Position(sglat, sglng);

            DotSpatial.Positioning.Distance dist = fab.DistanceTo(sg);

            return(dist.ToMeters().Value);
        } // End Function SpatialDistanceBetweenPlaces
Пример #2
0
        } // End Function SpatialDistanceBetweenPlaces

        public static double SpatialDistanceBetweenPlacesDotSpatial(
            double lat1
            , double lng1
            , double lat2
            , double lng2)
        {
            var fablat = new DotSpatial.Positioning.Latitude(lat1);
            var fablng = new DotSpatial.Positioning.Longitude(lng1);

            var sglat = new DotSpatial.Positioning.Latitude(lat2);
            var sglng = new DotSpatial.Positioning.Longitude(lng2);

            var fab = new DotSpatial.Positioning.Position(fablat, fablng);
            var sg  = new DotSpatial.Positioning.Position(sglat, sglng);

            DotSpatial.Positioning.Distance dist = fab.DistanceTo(sg);

            return(dist.ToMeters().Value);
        } // End Function SpatialDistanceBetweenPlacesDotSpatial