由经纬度计算Google卫星地图中瓦片Tile的地址
来源:互联网 发布:企业官网源码 编辑:程序博客网 时间:2024/04/26 19:06
推荐一个小工具:http://www.muqingshuihua.cn/tools/GoogleSatelliticTrace.html 在这个工具中输入经纬度数据,就可以逐级显示包含该经纬度的Google卫星图片。
Google卫星地图是由256x256大小的jpg图片拼接而成,每块图片的URL格式为“http://kh.google.com/kh?v=3&t=trstrq”样。参数v与图片关系不大,主要是参数t起作用,它是“qrst”4个字符排列而成的字符串。为获取某经纬度的URL,就需要把经纬度转化为“qrst”字符串。 Google卫星地图在zoom=1时,全球就为一个256x256的图片,它的中心经纬度为(0,0),URL为“http://kh.google.com/kh?v=3&t=t”。zoom=2时裂化为4块,每块的编号为:左上”t=tq”,右上”t=tr”,右下“t=ts”,左下”t=tt”。依此类推,每放大一倍,每一小块都裂分为四,从左上到右下顺时针按qrst编号,裂分后的编码为裂分前的编号上小块的编号。
计算代码如下:
function GetQuadtreeAddress(long, lat)
{
var PI = 3.1415926535897;
var digits = 18; // how many digits precision
// now convert to normalized square coordinates
// use standard equations to map into mercator projection
var x = (180.0 + parseFloat(long)) / 360.0;
var y = -parseFloat(lat) * PI / 180; // convert to radians
y = 0.5 * Math.log((1+Math.sin(y)) / (1 - Math.sin(y)));
y *= 1.0/(2 * PI); // scale factor from radians to normalized
y += 0.5; // and make y range from 0 - 1
var quad = "t"; // google addresses start with t
var lookup = "qrts"; // tl tr bl br
while (digits–)
{
// make sure we only look at fractional part
x -= Math.floor(x);
y -= Math.floor(y);
quad = quad + lookup.substr((x >= 0.5 ? 1 : 0) + (y >= 0.5 ? 2 : 0), 1);
// now descend into that square
x *= 2;
y *= 2;
}
return quad;
}
- 由经纬度计算Google卫星地图中瓦片Tile的地址
- [转]由经纬度计算Google卫星地图中瓦片Tile的地址
- 由经纬度计算Google卫星地图的URL
- 由地图经纬度获得地图瓦片编号
- Google卫星地图的URL计算
- C# 根据经纬度得到GOOGLE瓦片地址
- GOOGLE卫星地图 计算方式
- Google地图查地址、经纬度
- FlexViewer的Config中配置离线google地图的瓦片
- Google地图的经纬度
- 今天试着用公司的地址在google地图中找到他的经纬度
- 有感于GOOGLE的卫星地图!!!
- Google卫星地图的军事基地
- arcgis公开的地图瓦片地址
- Android中由IP地址查询经纬度坐标的实例
- 百度地图切面(瓦片)像素点和经纬度的关系
- cocos2d-x tile map瓦片地图的黑线及地图抖动解决方案
- 【转载】cocos2d-x tile map瓦片地图的黑线及地图抖动解决方案
- Color research and products - to teach you the beauty of four seasons with color dress
- Linux的快捷键和主要命令
- UVa 116 Unidirectional TSP
- 松鼠有错吗
- OAF中从弹性域获取值的明细页面
- 由经纬度计算Google卫星地图中瓦片Tile的地址
- 什么是脏读、不可重复读、幻读
- Linux网卡驱动分析
- Oracle 10g OCP 043 题库 1-40题 共185题
- 彻底明白Java语言中的IO系统
- google map 瓦片地图算法
- fcntl函数
- CreateProcess注入方法
- object-c 学习小记