<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Google卫星地图定位</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR>
<STYLE>
BUTTON {
BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 2px; PADDING-LEFT: 2px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; BORDER-RIGHT-WIDTH: 1px
}
INPUT {
BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 2px; PADDING-LEFT: 2px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; BORDER-RIGHT-WIDTH: 1px
}
INPUT {
TEXT-ALIGN: right
}
</STYLE>
</HEAD>
<BODY style="COLOR: #FFF; BACKGROUND-COLOR: #494949; TEXT-ALIGN: center" οnlοad=DoRebuild()>
<SCRIPT language=JavaScript type=text/javascript> <!--
function element(id)
{
return document.getElementById(id);
}
function DoRebuild()
{
var addr = GetQuadtreeAddress(element("input_longitude").value, element("input_latitude").value);
var coords = GetCoordinatesFromAddress(addr);
element("calculated_longitude").innerHTML = "" + GetSexagesimalNotation(coords.long);
element("calculated_latitude").innerHTML = "" + GetSexagesimalNotation(coords.lat);
// build a 3x3 table
var cursor = addr.substr(0, parseInt(element("input_zoom").value));
cursor = GetNextTileX(cursor,0); // move to top left
cursor = GetNextTileY(cursor,0);
for (var x = 0; x < 3; x++)
{
var c2 = cursor;
cursor = GetNextTileX(cursor,1);
for (var y = 0; y < 3; y++)
{
element("t" + y + x).style.backgroundImage = "url(" + "http://kh.google.com/kh?v=3&t=" + c2 + ")";
c2 = GetNextTileY(c2,1);
}
}
// populate the progression of images
for (var i = 0; i < 20; i++)
{
var el = element("m" + i);
if (el)
{
var src = "http://kh.google.com/kh?v=3&t=" + addr.substr(0, i+1);
el.alt = "Google Maps Address " + addr.substr(0, i+1);
el.style.backgroundImage = "url(" + src + ")";
el.src = "m" + addr.substr(i+1,1) + ".png";
}
}
}
function GetNextTileX(addr, forward)
{
if (addr == '')
return addr;
var parent = addr.substr(0, addr.length-1);
var last = addr.substr(addr.length-1);
if (last == 'q')
{
last = 'r';
if (!forward)
parent = GetNextTileX(parent, forward);
}
else if (last == 'r')
{
last = 'q';
if (forward)
parent = GetNextTileX(parent, forward);
}
else if (last == 's')
{
last = 't';
if (forward)
parent = GetNextTileX(parent, forward);
}
else if (last == 't')
{
last = 's';
if (!forward)
parent = GetNextTileX(parent, forward);
}
return parent + last;
}
function GetNextTileY(addr, forward)
{
if (addr == '')
return addr;
var parent = addr.substr(0, addr.length-1);
var last = addr.substr(addr.length-1);
if (last == 'q')
{
last = 't';
if (!forward)
parent = GetNextTileY(parent, forward);
}
else if (last == 'r')
{
last = 's';
if (!forward)
parent = GetNextTileY(parent, forward);
}
else if (last == 's')
{
last = 'r';
if (forward)
parent = GetNextTileY(parent, forward);
}
else if (last == 't')
{
last = 'q';
if (forward)
parent = GetNextTileY(parent, forward);
}
return parent + last;
}
function MercatorToNormal(y)
{
y = -y * Math.PI / 180; // convert to radians
y = Math.sin(y);
y = (1+y)/(1-y);
y = 0.5 * Math.log(y);
y *= 1.0 / (2 * Math.PI); // scale factor from radians to normalized
y += 0.5; // and make y range from 0 - 1
return y;
}
function NormalToMercator(y)
{
y -= 0.5;
y *= 2 * Math.PI;
y = Math.exp(y * 2);
y = (y-1)/(y+1);
y = Math.asin(y);
y = y * -180/Math.PI;
return y;
}
function GetSexagesimalNotation(x)
{
// 23° 27′ 30"
var ret = "";
if (x < 0)
{
ret += '-';
x = -x;
}
ret += Math.floor(x);
ret += '° ';
x = (x - Math.floor(x)) * 60;
ret += Math.floor(x);
ret += "' ";
x = (x - Math.floor(x)) * 60;
ret += Math.floor(x);
ret += '" ';
return ret;
}
function GetCoordinatesFromAddress(str)
{
// get normalized coordinate first
var x = 0.0;
var y = 0.0;
var scale = 1.0;
str = str.toLowerCase();
str = str.substr(1); // skip the first character
while (str.length > 0)
{
scale *= 0.5;
var c = str.charAt(0); // remove first character
if (c == 'r' || c == 's')
{
x += scale;
}
if (c == 't' || c == 's')
{
y += scale;
}
str = str.substr(1);
}
var ret = new Object();
ret.longmin = (x - 0.5) * 360;
ret.latmin = NormalToMercator(y);
ret.longmax = (x + scale - 0.5) * 360;
ret.latmax = NormalToMercator(y + scale);
ret.long = (x + scale * 0.5 - 0.5) * 360;
ret.lat = NormalToMercator(y + scale * 0.5);
return ret;
}
function GetQuadtreeAddress(long, lat)
{
// now convert to normalized square coordinates
// use standard equations to map into mercator projection
var x = (180.0 + parseFloat(long)) / 360.0;
var y = MercatorToNormal(parseFloat(lat));
var quad = "t"; // google addresses start with t
var lookup = "qrts"; // tl tr bl br
for (digits = 0; digits < 24; 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;
}
//--> </SCRIPT>
<div id="divTop">
<a href="http://www.muqingshuihua.cn"><strong><font color="#FFFFFF">回首页</font></strong></a> <a href="http://www.muqingshuihua.cn/tools/"><strong><font color="#FFFFFF">GIS工具</font></strong></a></div>
<H2>通过经纬度定位 Google 卫星地图中的瓦片Tiles</H2>
<FORM name=theForm onSubmit="DoRebuild(); return false;">请输入经度/纬度/级别(国内最高19级)<INPUT id=input_longitude style="WIDTH: 6em"
value=113.309577 name=longitude> <INPUT id=input_latitude style="WIDTH: 6em"
value=23.117899 name=latitude> <INPUT id=input_zoom style="WIDTH: 6em" value=19
name=zoom><BUTTON style="MARGIN: 0pt 8px" type=submit>Rebuild</BUTTON> </FORM>
<DIV>(图片中心点: <SPAN id=calculated_longitude></SPAN>, <SPAN
id=calculated_latitude></SPAN>)</DIV>
<TABLE
style="BORDER-RIGHT: white 2px solid; BORDER-TOP: white 2px solid; MARGIN: 1em auto; BORDER-LEFT: white 2px solid; BORDER-BOTTOM: white 2px solid; BACKGROUND-COLOR: rgb(17,17,68)"
cellSpacing=0 cellPadding=0 align=center>
<TBODY>
<TR>
<TD id=t00
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsstrst)"
width=256 height=256> </TD>
<TD id=t01
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsstrss)"
width=256 height=256> </TD>
<TD id=t02
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsssqtt)"
width=256 height=256> </TD></TR>
<TR>
<TD id=t10
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsstsrq)"
width=256 height=256> </TD>
<TD id=t11
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsstsrr)"
width=256 height=256> </TD>
<TD id=t12
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttssstqq)"
width=256 height=256> </TD></TR>
<TR>
<TD id=t20
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsstsrt)"
width=256 height=256> </TD>
<TD id=t21
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsstsrs)"
width=256 height=256> </TD>
<TD id=t22
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttssstqt)"
width=256 height=256> </TD></TR></TBODY></TABLE>
<H2>含有此经纬度的所有瓦片Tiles</H2><IMG id=m0
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=t)"
alt="Google Maps Address t" hspace=0
src="ms.png"> <IMG id=m1
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=ts)"
alt="Google Maps Address ts" hspace=0
src="mr.png"> <IMG id=m2
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsr)"
alt="Google Maps Address tsr" hspace=0
src="mr.png"> <IMG id=m3
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrr)"
alt="Google Maps Address tsrr" hspace=0
src="mt.png"> <IMG id=m4
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrt)"
alt="Google Maps Address tsrrt" hspace=0
src="ms.png"> <IMG id=m5
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrts)"
alt="Google Maps Address tsrrts" hspace=0
src="mq.png"> <IMG id=m6
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsq)"
alt="Google Maps Address tsrrtsq" hspace=0
src="mr.png"> <IMG id=m7
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqr)"
alt="Google Maps Address tsrrtsqr" hspace=0
src="ms.png"> <IMG id=m8
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrs)"
alt="Google Maps Address tsrrtsqrs" hspace=0
src="ms.png"> <IMG id=m9
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrss)"
alt="Google Maps Address tsrrtsqrss" hspace=0
src="mq.png"> <IMG id=m10
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssq)"
alt="Google Maps Address tsrrtsqrssq" hspace=0
src="mq.png"> <IMG id=m11
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqq)"
alt="Google Maps Address tsrrtsqrssqq" hspace=0
src="mt.png"> <IMG id=m12
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqt)"
alt="Google Maps Address tsrrtsqrssqqt" hspace=0
src="mt.png"> <IMG id=m13
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqtt)"
alt="Google Maps Address tsrrtsqrssqqtt" hspace=0
src="ms.png"> <IMG id=m14
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqtts)"
alt="Google Maps Address tsrrtsqrssqqtts" hspace=0
src="ms.png"> <IMG id=m15
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttss)"
alt="Google Maps Address tsrrtsqrssqqttss" hspace=0
src="mt.png"> <IMG id=m16
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsst)"
alt="Google Maps Address tsrrtsqrssqqttsst" hspace=0
src="ms.png"> <IMG id=m17
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttssts)"
alt="Google Maps Address tsrrtsqrssqqttssts" hspace=0
src="mr.png"> <IMG id=m18
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsstsr)"
alt="Google Maps Address tsrrtsqrssqqttsstsr" hspace=0
src="mr.png"> <IMG id=m19
style="BACKGROUND-IMAGE: url(http://kh.google.com/kh?v=3&t=tsrrtsqrssqqttsstsrr)"
alt="Google Maps Address tsrrtsqrssqqttsstsrr" hspace=0
src="mr.png">
<P></P>
<P>PoweredBy:<A href="http://www.muqingshuihua.cn/"><strong><font color="#FFFFFF">穆清水华GIS工作室</font></strong></A>
<script type="text/javascript" src="http://js.tongji.cn.yahoo.com/459416/ystat.js"></script><noscript><a href="http://tongji.cn.yahoo.com"><img src="http://img.tongji.cn.yahoo.com/459416/ystat.gif"/></a></noscript>
</P>
</BODY>
</HTML>
来源:CSDN
作者:allun
链接:https://blog.csdn.net/allun/article/details/4038332