Calculate the distance between two points in bing cards

I have a bing card and two points: Point1, Point2 and I want to calculate the distance between these two points? is it possible? and if I want to put a circle two-thirds of the way between points 1 and 2 and next to point 2 ... how can I do this?

+3
source share
4 answers

See Haversine or even better Vincenty how to solve this problem.

The following code uses the haversines method to obtain the distance:

public double GetDistanceBetweenPoints(double lat1, double long1, double lat2, double long2)
    {
        double distance = 0;

        double dLat = (lat2 - lat1) / 180* Math.PI;
        double dLong = (long2 - long1) / 180 * Math.PI;

        double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2)
                    + Math.Cos(lat1 / 180* Math.PI) * Math.Cos(lat2 / 180* Math.PI) 
                    * Math.Sin(dLong/2) * Math.Sin(dLong/2);
        double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));

        //Calculate radius of earth
        // For this you can assume any of the two points.
        double radiusE = 6378135; // Equatorial radius, in metres
        double radiusP = 6356750; // Polar Radius

        //Numerator part of function
        double nr = Math.Pow(radiusE * radiusP * Math.Cos(lat1 / 180 * Math.PI), 2);
        //Denominator part of the function
        double dr = Math.Pow(radiusE * Math.Cos(lat1 / 180 * Math.PI), 2)
                        + Math.Pow(radiusP * Math.Sin(lat1 / 180 * Math.PI), 2);
        double radius = Math.Sqrt(nr / dr);

        //Calculate distance in meters.
        distance = radius * c;
        return distance; // distance in meters
    }

You can find a good site with information here .

+10
source

Microsoft GeoCoordinate.GetDistanceTo, .

NaN . .

+12

() , (, sperioid/projection). DotSpatial SharpMap /unittests/sources... .

, bearing , ( ), . " " Vincenty's. silverlight/.net

GIS Stackexchange. , . long long x- ( ) . . ( ).

- ArcGIS API Silverlight, Bing Maps. , , ( , SDK). . "" .

+2
source

As I said: look at this page for more information about your problem. There you will find a formula, Javascript code, and an Excel sample for calculating the destination at a given distance and from the starting point (see Headers).

No need to "convert" code to your C # -world.

0
source

All Articles