Created
June 24, 2014 14:18
-
-
Save igorkulman/9fa0a229b9c2db57a172 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static GeoCoordinate AddMetersToGeoCoordinate(GeoCoordinate current, double metersH, double metersV) | |
{ | |
return new GeoCoordinate(current.Latitude + (metersH / (111111)), current.Longitude + (metersV / (111111 * Math.Cos(current.Latitude)))); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static double MetersToPixels(double meters, double latitude, double zoomLevel) | |
{ | |
var pixels = meters / (156543.04 * Math.Cos(latitude) / (Math.Pow(2, zoomLevel))); | |
return Math.Abs(pixels); | |
} | |
public static double PixelsToMeters(double pixels, double latitude, double zoomLevel) | |
{ | |
return pixels * (156543.04 * Math.Cos(latitude) / (Math.Pow(2, zoomLevel))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment