Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import math
  2.  
  3. def merc_x(lon):
  4. r_major=6378137.000
  5. return r_major*math.radians(lon)
  6.  
  7. def merc_y(lat):
  8. if lat>89.5:lat=89.5
  9. if lat<-89.5:lat=-89.5
  10. r_major=6378137.000
  11. r_minor=6356752.3142
  12. temp=r_minor/r_major
  13. eccent=math.sqrt(1-temp**2)
  14. phi=math.radians(lat)
  15. sinphi=math.sin(phi)
  16. con=eccent*sinphi
  17. com=eccent/2
  18. con=((1.0-con)/(1.0+con))**com
  19. ts=math.tan((math.pi/2-phi)/2)/con
  20. y=0-r_major*math.log(ts)
  21. return y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement