Click here to Skip to main content
15,038,467 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
My application is getting a maps images from "Google static maps" using a center point location"Lat,Lon" , image size 600*600 and specified zoom
Now to work on maps i need to know the distance per pixel in it
i think it should be calculate by zoom, image size and center location but i don't know the way to do that

My application is windows form
Posted

1 solution

I calculate it by using the center point
C#
double earthC = 6371000 * 2 * Math.PI;
double factor = Math.Pow(2, 8 + m_intZoomLevel);
double MeterPerPixel = (Math.Cos(CenterLat * Math.PI / 180) * earthC / factor)/2;
double MapWidthDistance = OrginalImageWidth * MeterPerPixel;
double ActualMeterPerPixel = MapWidthDistance / imgWidthAfterResize;
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900