I have a map, the centre of that map (centrepoint) is = -37,175 ( gps)
I know the zoom of the map = 13
I know the size = 320x320px
I know there is 111111m in a degree of latitude and a varying degree in longitude
I want to be able to calculate the value to add and subtract from the centre coordinate that will give me an upperleft/lowerright gps coordinate.
For a zoom of 13 I used to achieve this by
Note :centrelat= -37
eg :-37 - (-37/1650) = -36.9776 deg. In other words to find the southeast corner we subtracted .0228 degrees from the centre coordinate. I did the same for longitude but used the value 6250
eg :175 - (175/6250) (.02804 degrees). = 174.792, ie the northwest corner
the ratio between .0228 degrees (lat)and .0280 degrees(long) is correct
So, I want this calculation to be dynamic and work for all zooms
so I'm using (cos Latitude x 111111) / 2^Zoom(13) = 10.72095
for longitude I'm using 111111/2^13 = 13.56
This is the same ratio as well so I'm on the right track!
but how do I use these values in a calculation to add or subtract degrees from the centre coordinates for lat and long to get the coordinates for the corners of the bounding box.
any help is appreciated, and I do mean that.