I was born at Tsrrtrsqsqqqrqrtsst
Sunday, July 17th, 2005I’ve been playing around with the marvellous and , 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]
address 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:
Converting between Quadtree addresses and Longitude/Latitude
This page contains Javascript to returns all tiles containing a particular location, with each yellow quadrant marking the region occupied by the subsequent map. If you’d like to copy the code you can view the page source, or simply use the excerpts shown below. The first two functions are based on equations from Wikipedia’s entry on the Mercator Projection.
July 18th, 2005 at 1:26 am
I’m fairly sure that I’m somewhere in tsrrttsrsqqrrs, but it’s kinda hard to follow with all that pixellation :/
July 18th, 2005 at 5:39 pm
Annoying when you just miss out isn’t it? My parents’ house is within 100m of the hi-resolution images– if it were in the middle of town I think I would be creating a poster sized print for them right now…
July 30th, 2005 at 4:07 pm
[…] log] Imatges per refer讣nciaPosted by Ferran on 30/07/2005 06:07:41 pmHe llegit al blog de Intepid una manera d’obtenri dinamicament la imatge per satel.lit d’una posici del planeta, o d’ […]
August 13th, 2005 at 7:05 am
Yesterday projection=2 was disabled
June 10th, 2006 at 11:38 am
Entry updated with source code for converting long/lat to quadtree address.
June 16th, 2006 at 8:26 pm
very good,if I have convert from a latitude & longitude to a Google Maps quadtree address (an URL to a particular image tile.How can I get all image tiles in one range from latitude to latitude and longitude to longitude.
July 16th, 2006 at 2:06 am
Hey man,
I say: Well done!!! Your code workes very well! Now I need another function and maybe you have it already?!? Thats why I ask… ;-)
You have described how to get the filename by coordinates, but I need to get the coordinates by filename! Is that possible?!?
Thanks for help as soon as possible. Right now I am sitting on that problem becasue I am going to asia for earthquake help next week and I need some more satelite files. Thanks, Pete
October 10th, 2006 at 11:05 pm
Thanks for the code. There seems to be a typo: shouldn´t this be (digits–) instead of (digits-)?
October 10th, 2006 at 11:27 pm
It seems that my blogging software is displaying two minus signs as an endash “–”, and has done exactly the same with your comment. I haven’t figured out how to turn this “feature” off yet…
February 7th, 2007 at 5:01 am
[…] And the Satellite ’s url hack u can find from here: intepid » I was born at TSRRTRSQSQQQRQRTSS […]
May 8th, 2007 at 8:25 pm
Because Mercator Projection is limietd in hignest latitude,I want to konw that Google Earth how to solve this question.
May 9th, 2007 at 1:32 pm
It is likely that beyond a certain latitude Google Earth switches to a different coord system, using separate maps for the poles
May 10th, 2007 at 8:42 pm
But,in the first and the second layers we can find that Google earth using Mercator Projection .Maybe the third,the forth also using Mercator Projection .In fact Google eatrh can not using Mercator Projection in all layers.But how to judge it?
May 18th, 2007 at 10:27 pm
A stupid question about the range of y in the line “y = 0.5 * Math.log((1+Math.sin(y)) / (1 - Math.sin(y)))”. Isn’t it from negative infinite to infinite? How could it be scaled to normalized? Thanks a lot. Confused Tian
May 20th, 2007 at 10:38 am
Hi Tian, you can see this mentioned in a later post here.
May 23rd, 2007 at 6:52 pm
Thanks mark :-) I made a reverse code to get long&lat from a quad based on yours.
August 2nd, 2007 at 9:19 pm
Very cool !
Exactly what I was looking for !
Thanks !
September 4th, 2007 at 6:47 am
I know this is old..but thank you! This is just what I have been looking for!
October 8th, 2007 at 5:03 am
you hack is more elegant than thier design
December 10th, 2007 at 11:39 am
good artical!
January 30th, 2008 at 9:31 am
I need calibrate a qrst type img. I need know lat/long of 2 corner of img. Can help me?
May 27th, 2008 at 5:06 am
i’m also need to know the latlon of two corner of the image
May 27th, 2008 at 11:53 am
I’ve added function GetCoordinatesFromAddress(str) to the code (and here) which returns center, minimum and maximum coordinates from quadtree address
May 27th, 2008 at 7:46 pm
realy thank you this is agreat work
August 27th, 2008 at 3:47 am
Really a good job, thank! I am going to programming on google map, and I will email you if any problem. Don’t refuse me! Thanks again.
October 11th, 2008 at 3:32 am
Nice job! I have a question, though: If the whole 360 degrees of the long are divided by 2 the same number of times that the 180 degrees of the lat, then each tile is a rectangle (wide one) near the equator, and a rectangle (tall one) near the poles, being a square only when lat = 60. Why all the tiles are square?