Hello
am use google static maps in my windows form app
when i get the map i set the center point "latitude,longitude" , zoom and image size
the boundaries coordinates calculated by this code
double scale = Math.Pow(2, m_intZoom);
NW_Latitude = CenterLat + (PicSizeY / 2) / scale;
NW_Longitude = CenterLon - (PicSizeX / 2) / scale;
NE_Longitude = CenterLon + (PicSizeX / 2) / scale;
WS_Latitude = CenterLat - (PicSizeY / 2) / scale;
Now
i found a way to calculate the distance between two coords
double earthR = 6371;
double deltaLat = 0;
double deltaLon = (m_dblLocationNWLongitude - m_dblLocationNELongitude) * Math.PI / 180;
double a = Math.Sin(deltaLat / 2) * Math.Sin(deltaLat / 2) +
Math.Cos(m_dblLocationNWLatitude * Math.PI / 180) * Math.Cos(m_dblLocationNWLatitude * Math.PI / 180) *
Math.Sin(deltaLon / 2) * Math.Sin(deltaLon / 2);
double b = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
MapWidthDistance = earthR * b;
deltaLat = (m_dblLocationNWLatitude - m_dblLocationWSLatitude) * Math.PI / 180;
deltaLon = 0;
a = Math.Sin(deltaLat / 2) * Math.Sin(deltaLat / 2) +
Math.Cos(m_dblLocationNWLatitude * Math.PI / 180) *
Math.Cos(m_dblLocationNWLatitude * Math.PI / 180) *
Math.Sin(deltaLon / 2) * Math.Sin(deltaLon / 2);
b = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
MapHeightDistance = earthR * b;
but i think there is something wrong because when i set the image size to 600x600
and calculate the distance i got MapWidthDistance != MapHeightDistance
note that the area covered in map is small and defined as a square
Any Suggestions or Solutions?