static private double DistanceCalculate(GeoCoordinate fromCoordanate, GeoCoordinate toCoordanate) { double distance = 0.0; double circumference = 40000.0; // Earth's circumference at the equator in km //Calculate radians double latitudeFromRad = DegreesToRadians(fromCoordanate.Latitude); double longitudeFromRad = DegreesToRadians(fromCoordanate.Longitude); double latititudeToRad = DegreesToRadians(toCoordanate.Latitude); double longitudeToRad = DegreesToRadians(toCoordanate.Longitude); double logitudeDiff = Math.Abs(longitudeFromRad - longitudeToRad); if (logitudeDiff > Math.PI) { logitudeDiff = 2.0 * Math.PI - logitudeDiff; } double angleCalculation = Math.Acos( Math.Sin(latititudeToRad) * Math.Sin(latitudeFromRad) + Math.Cos(latititudeToRad) * Math.Cos(latitudeFromRad) * Math.Cos(logitudeDiff)); distance = circumference * angleCalculation / (2.0 * Math.PI); return distance; }
public LocationMarker(ScnDiscounts.Helpers.GeoCoordinate coordinates) { System.Windows.Controls.Image imgPin = new System.Windows.Controls.Image(); BitmapImage bmp = new BitmapImage(new Uri(@"/assets/MapPins/ic_pin_navigation.png", UriKind.Relative)); imgPin.Source = bmp; //imgPin.Width = 60; //imgPin.Height = 60; Content = imgPin; GeoCoordinate = new System.Device.Location.GeoCoordinate(coordinates.Latitude, coordinates.Longitude); PositionOrigin = new System.Windows.Point(0.0, 0.0); }
public GeoLocationEventArgs(GeoCoordinate coordinates) { Coordinate = coordinates; }