Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > 服务器相关 > google影像命名与经伟度的转换
【标  题】:google影像命名与经伟度的转换
【关键字】:google
【来  源】:http://www.cublog.cn/u/11456/showart.php?id=255855

google影像命名与经伟度的转换

Your Ad Here

I’ve been playing around with the marvellous Google Earth and Google Maps, and just noticed how elegant the system for addressing image tiles is [specifically from Google Maps].

Google Maps now offers a satellite view as well as a map view, and does so using the former Keyhole database. The view is built using tiles— 256 pixel square JPEGs fetched from the the kh.google.com server.

As of this writing, the image URLs take the form:

http://kh.google.com/kh?v=projection&t=address

projection is either 2 or 3. Selecting 2 gives a plate carrée projection, while 3 provides a Mercator projection, ensuring that local features are uniformly scaled. [Update: projection type 2 is no longer supported]

quadtree recursive subdivisionaddress is a short string of letters encoding the location of a particular map square. The addressing mode is quite elegant, with the world recursively quartered until the desired detail level is reached. This simple heirarchical structure is known as a quadtree, and is commonly used in computer graphics. For whatever reason, Google labels the four quadrants q, r, s & t.

The topmost tile contains the entire world map, and is referenced with an address of t. Adding an s to this selects the lower-right quadrant of the map, and adding a further r selects the upper-right of that map, resulting in a tile containing most of Australasia. Each time an extra letter is added, we descend into a new quadrant, and this continues until the maximum detail is reached. So, for example, the hospital where I was born can be uniquely addressed [to within a hundred metres or so] using the URL:

http://kh.google.com/kh?v=3&t=tsrrtrsqsqqqrqrtss

Click here to see the sequence of all tiles containing that particular location, with each yellow quadrant marking the region occupied by the subsequent map.

The page uses the following Javascript code to convert longitude and latitude into a quadtree address. The first part of the code is based on equations from Wikipedia’s entry on the Mercator Projection.

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--) // (post-decrement)
{
// 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;
}
Regex學習日記:在Java Script中使用Regex:【上一篇】
华为路由器上的L2TP配置:【下一篇】
【相关文章】
  • 分析人士:微软网络业务前景不佳难敌google
  • google notebook 的firefox扩展的安装
  • google技术
  • Google网页加速器的工作原理(转载)
  • 利用Google把你的頁面翻译成英文(一個學習英文或有此功能需要的進)
  • 新年第一帖 :用google提高你的工作效率
  • 7个有效的文本编辑习惯 - Bram Moolenaar在google的演讲
  • 如何提升Google排名?
  • 关于google file System,创建元老
  • Google文件中文版试用
  • 【随机文章】
  • 写给即将步入大学,主修计算机专业的青年们的一封信
  • Complete Permutation
  • 对sybase处理字符串的一些体会
  • 很好的一篇文章
  • FrontPage服务器扩展
  • 一个通用的NAT脚本,非常方便
  • format常用用法
  • 蓝牙系统的无线接入
  • IRP 乱杂谈[转]
  • ADO 错误代码
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.