小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

Google Earth衛(wèi)星地圖URL的計算方法及代碼實例...

 古羅 2008-01-10

Google Earth衛(wèi)星地圖URL的計算方法及代碼實例

[ 來源:互聯(lián)網(wǎng) | 時間:2007年11月09日 | 收藏本文 ] 【

Google衛(wèi)星地圖在zoom=1時,全球就為一個256x256的圖片,它的中心經(jīng)緯度為(0,0),URL為“http://kh.google.com/kh?v=2&t=t”。zoom=2時裂化為4塊,每塊的編號為:左上”t=tq”,右上”t=tr”,右下“t=ts”,左下”t=tt”。依此類推,每放大一倍,每一小塊都裂分為四,從左上到右下順時針按qrst編號,裂分后的編碼為裂分前的編號上小塊的編號

Google衛(wèi)星地圖是由256x256大小的jpeg圖片拼接而成,每塊圖片的URL格式為“http://kh.google.com/kh?v=2&t=trstrqqstsrqttsttq”樣。參數(shù)v與圖片關(guān)系不大,主要是參數(shù)t起作用,它是“qrst”4個字符排列而成的字符串。為獲取某經(jīng)緯度的URL,就需要把經(jīng)緯度轉(zhuǎn)化為“qrst”字符串。

兩個代碼如下

Gmap URL_JS
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;
}

 

Gmap URL_Delphi
function getSatURL(zoom: integer; X, Y: double): string;
var
  wx, wy, cx, cy: double;
  tid: string;
  i: integer;
begin
  cx := 0;
  cy := 0;
  wx := 180;
  wy := 180;
  tid := 't';

  for i := 1 to zoom-1 do
  begin
    if (x >= cx) and (y >= cy) then
    begin
      tid := tid + 'r';
      cx := cx + wx / 2;
      cy := cy + wy / 2;
    end
    else if (x >= cx) and (y < cy) then
    begin
      tid := tid + 's';
      cx := cx + wx / 2;
      cy := cy - wy / 2;
    end
    else if (x < cx) and (y < cy) then
    begin
      tid := tid + 't';
      cx := cx - wx / 2;
      cy := cy - wy / 2;
    end
    else
    begin
      tid := tid + 'q';
      cx := cx - wx / 2;
      cy := cy + wy / 2;
    end;
    wx := wx / 2;
    wy := wy / 2;
  end;
  result := 'http://kh.google.com/kh?v=2&t=' + tid;
end;

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多