# calculating bounding box from known centre coordinate and zoom

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.

-
For what purpose are using this Bounding box? In what projection will the bounding box be? It is often easier to project the GPS point to your intended projection (usually Web Mercator) and then create he bounding Box in Meters. – Devdatta Tengshe Mar 9 '13 at 14:09
Thanks for the reply, I am trying to plot multiple points on a canvas, the background of which is a map. I cant do this server side or with Javascript, it must be done on the device. So the bounding box will give me the corner coordinates and from there I hope to draw the points in relation to the known corners and centrepoint – user1637477 Mar 10 '13 at 5:11