Reputation: 3979
I work with bing from some days. I can display an image with my bing map coordinates lontitude and latitude.
But I would like to calculate the coordinates of location in the 4 edges of my image. For now the only thing I know is the central point of origin. The problem is that I'm limited to API. I work for a games xna c # and unfortunately can not use the Class Map from microsoft :-(. http://msdn.microsoft.com/en-us/library/hh846504.aspx
I know the following values: (sample value)
LevelZoom: 17
ImageWidth: 800 px
Imageheight: 800 px
Lat: 46.6023
Longitude: 7.0964
Is it possible to calculate the coordinates of the 4 corners of my image with these 5 values known? Here is a drawing explaining what I want. Thanks a lot
Upvotes: 2
Views: 2590
Reputation: 9397
Based on the scale 1.19 m/pixel given by the bing maps api for a level 17 zoom this gives us 800 * 1.19 = 95'000 meters edges (http://msdn.microsoft.com/en-us/library/aa940990.aspx)
You should be able to calculate it this way : (alorithm : https://gis.stackexchange.com/questions/2951/algorithm-for-offsetting-a-latitude-longitude-by-some-amount-of-meters)
//Position, decimal degrees
lat = 46.6023
lon = 7.0964
//Earth’s radius, sphere
R=6378137
// DO THE SAME FOR B C D
//offsets in meters for A
dn = -47600
de = -47600
//Coordinate offsets in radians
dLat = dn/R // -0.0074629942881440144669203562106
dLon = de/(R*Cos(Pi*lat/180)) // -0.00746374633301685016002447644032
//OffsetPosition, decimal degrees
latA = lat + dLat * 180/Pi // 46.174701924759107796879309401922
lonA = lon + dLon * 180/Pi // 6.6687588357618898589751458712973
This use a simplified flat earth calculation which is not the most accurate method but should meet your need though.
Upvotes: 4