Google Maps data algorithm

Source: Internet
Author: User
Tags sin

Each image in Google Maps and Google Earth has a URL, for example, the address of our school map is http://kh.google.com/kh?v=3&t= TRSTRQQRSSTTTQTSS (this is the URL of the graph)

The variable v=3 in the URL represents the projection algorithm of the satellite graph using the Mercator projection algorithm, v=2 represents another algorithm (no longer supported)

variable T=trstrqqrsstttqtss, this is the image of the code, TRSTRQQRSSTTTQTSS is a similar "Q-tree" algorithm calculation. He will be a picture of the upper left, upper right, lower left, lower right with q,r,t,s respectively. Then recursively go down in turn. The top is t.

If I want to see the top level of the world map then the code is "T", the URL is as follows:
Http://kh.google.com/kh?v=3&t=t Click on the link to the left and you will see the world map (maximum level).

If I continue to find the map of China (which is actually the upper right part of the middle), then the code is "tr" and the URL is as follows:
HTTP://KH.GOOGLE.COM/KH?V=3&T=TR Click on the link to the left you will see the upper right-hand corner of the upper world map (that is, the part that contains China).
And so on, you can find the map of the location you need to find. (A simple explanation for this manipulation, with a yellow box in the upper right corner for "R")

Here is a tool to enter your latitude and longitude in this tool, and he will automatically recursively return each image. You can take a step-by-step look at how Google Maps found your location. http://intepid.com/stuff/gmkh/

About Q-tress can find this data structure of the book to learn about, below is the map I found from Wikipedia

Here is the JavaScript program for this algorithm (including encoding and latitude and longitude)

function getquadtreeaddress (long, lat) {varPI =3.1415926535897;var digits = 18; //How many digits precision//now convert to normalized square Coordinat es//use standard equations to map into Mercator Projectionvar x =  (180.0 + parsefloat (long))   / 360.0;var y =-parsefloat (lat)  * PI/ 180; //convert to Radiansy = 0.5 *  Math.log ((1+math.sin (y))  /  (1 - math.sin (y))), Y *= 1.0/(2 * PI),  //scale Factor from radians to normalizedy += 0.5; //and make y range from 0-1var quad =  "T";  //GOOGL E addresses start with tvar lookup =  "Qrts";  //tl tr bl brwhile  (digits–)  //(post-decrement) { Make sure we have look at fractional partx-= math.floor (x); y-= math.floor (y); quad = Quad + lookup.subs TR ((x >= 0.5 ? 1 : 0)  +  (y >= 0.5 ? 2 : 0),  1);//now descend to that Squarex *= 2;y *= 2;} Return quad;}

The above contents refer to:
Http://intepid.com/2005-07-17/21.50/

Google Maps data algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.