On Aug 9, 2013, at 8:04 PM, Matthew Aidekman User wrote:

> Ivan,  I gave your quick and dirty way a shot,  (the scope of my project is 
> very small so quick and dirty might work)  but I must be doing something 
> wrong.  Currently my display is squashed vertically and if I'm interpreting 
> your suggestion correctly, it only has the capability of vertically squashing 
> the image even more.  
> 
> You're suggesting something like this?
> 
> quickProjection(x y,centerOfDisplayY){
>     return [x   ,   y*cos(vertCenterOfDisplay/180*pi)   ];
> }
> 
> Multiplying anything*cos(anything) will only squash the results.  

You should multiply the horizontal distance by the cosine of the latitude.

Let's say the center of the map is at (lat0,lon0). Then to find the (x,y) 
displacement of a nearby (lat,lon) location from the center, calculate the 
following:

x = R * cos(lat0) * (lon - lon0)
y = R * (lat - lat0)

R is the radius of the earth = 6378km.

This assumes a spherical earth. There are more accurate formulae that take into 
account the ellipsoidal shape of the earth. However, the above may be good 
enough for a quick-and-dirty projection. See 
<http://williams.best.vwh.net/avform.htm#flat>


_______________________________________________
newbies mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/newbies

Reply via email to