标签:tor 经纬 indicator org open lin oom 2.0 wiki
# OpenStreetMap经纬度转行列号 def deg2num(lat_deg, lon_deg, zoom): lat_rad = math.radians(lat_deg) n = 2.0 ** zoom xtile = int((lon_deg + 180.0) / 360.0 * n) ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * n) return (xtile, ytile) # OpenStreetMap行列号转经纬度 def num2deg(xtile, ytile, zoom): n = 2.0 ** zoom lon_deg = xtile / n * 360.0 - 180.0 lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * ytile / n))) lat_deg = math.degrees(lat_rad) return (lat_deg, lon_deg) # 验证可用 print deg2num(34.972,114.953,13) # print num2deg(105207,52262,17)
OpenStreetMap、googleMap等经纬度和行列号之间相互转化
标签:tor 经纬 indicator org open lin oom 2.0 wiki
原文地址:http://www.cnblogs.com/Micang/p/6346446.html