# Google Maps Ground Overlay: How to calculate bounds?

I'm working with the Google Maps API for the first time and I'm trying to append a simple image of a Building on top of my current map view.

This seems to be very straight forward when I look at the GMapsAPI here … https://developers.google.com/maps/documentation/javascript/overlays#GroundOverlays

However, I have no idea how to calculate the bounds and the exact position of my overlay.

As you can see in the documentation the position of the ground overlay is done via LatLng

In my case I have no idea how to calculate those bounds. What are those values exactly? Why are there two seperate LatLng positions needed?

I have a simple .png of a building that I want to layer on top of an exact position. I get this position by entering the destination in Google Maps and reading the Lat and Lng values from the embed-code.

Is there a better way of doing this? Any ideas, tipps or tricks on how I could do this?

Or is it possible to calculate those bounds when I know the center of the image-position and the dimesions of my image file? (My image is 50x50px and a .png)

Kind Regards, Matt

-
Most of the time when two coordinates are needed for a "bounds", it is looking for two corners of the image, such as the southwest corner and northeast corner. Or the other two corners. – MLowry Aug 6 '12 at 15:42
Yeah, but how do I get those corners? I know the exact coordinates of the center - that's just the center of the current destination of what I'm looking at inside google maps. But how do I get the corner-coordinates of a 50x50px image I want to center exactly on the coordinates I'm talking about. Is there a way to calculate the coordinates of the southwest and northeast corner when I know the center of the image and the dimensions of the image? I wonder how those coordinates and my pixel-values of the image are working together? – matt Aug 6 '12 at 17:40