Thursday, April 07, 2005

Google Map

I was amazed at the way Google Maps works! It is way faster than Yahoo or MSN or MapQuest ( I think is equally fast, i like the zooming effect )

Google Maps uses two built-in browser components:
-> XMLHttpRequest ( very famous, used in Google Suggest) and
-> XSLTProcessor

Google Map communicates with the server to get the map tiles and search results
It basically gets 3 types of images from the server ( based on the selection)

1) JPEG Image in case of satellite image
It sends a GET request to Keyhole Server 2.4 at
Sample Get request

Value of
v = No idea, seems to work with different values, maybe for some internal usage
t = direction to be taken to get the desired JPEG image tile


-> t can have maximum 15 characters ( i.e 15 zoom levels)
-> suppose intially t = tqt ( so it will fetch 4 tiles, for top-left, top-right, bottom-left, bottom-right ) next time if t = tqtt , it means fetch the bottom-left tile and zoom it ( ie it will again fetch 4 more tiles )

2) GIF Image in case of map image
It sends a GET request to Keyhole Server 2.4 at
Sample Get request
v = No Idea
x = X coordinate of the tile to be fetched
y = Y coordinate of the tile to be fetched
zoom = zoom level ( 1 – 5 )
So it is possible to fetch the entire image database of Google maps, if we write a script which will fetch all image tiles for a given zoom level but obviously it is copyrighted!

3) PNG Image is returned which is basically the route between 2 locations (It is a white image with the route displayed in blue) and it is superimposed onto the image tiles.

It is again a GET request to Geocode/Map Server

Sample request:{F{MGBGKZONVPVr@hA@@r@f@v@j@JFJJ?RQN?V?B?L?R@@?L?x@?ZA??JO?@LH??X}oR

width/height = width/height of the resulting PNG file.
Path = yet to figure out ( i think the encoded string should contain the source and destination location ???? )

When we search for any city, say New York, it sends a HTTP GET request to mfe server. e.g.

q = name of the location
sll = latitude & longitude
sspn = span size
z = zoom level
the output of such a request is XML

<?xml version="1.0"?>
<title>new york</title>
<query>new york</query>
<query>new york</query>
<center lat="40.714167" lng="-74.006389"/>
<span lat="0.089988" lng="-0.118722"/>
<overlay panelStyle="/maps?file=gp&hl=en">
<location infoStyle="/maps?file=gi&hl=en" id="A">
<point lat="40.714167" lng="-74.006389"/>
<icon class="noicon"/>
New York, NY

Location of XSL files
1) panelStyle =
2) infoStyle =

I read somewhere that this kind of apps are called AJAX ( Advanced Javascript & XML )

I personally think that Google might have pre-calculated routes between all locations ( if not all, atleast between important places). So when we try to find route between, say, A to B, Google would have precomputed it and would be in memory. So it can retrieve the path and send it back to the client.

One addition what Google could probably add is Traffic so that route displayed is the route with least traffic ( As I assume they have precomputed routes and put it in memory, assume 5 routes are there between A to B, all it has to do is to add weight ( traffic density) at run-time to all the 5 routes and return the route with the least traffic.

This is all I could manage to figure out in 2 hrs. Will post, once I find out more .


Abhishek said...

good work XP

Kiran Desai said...

Thts a lot of gyaan early in the morning :) Thanks for all the analysis dude! Put up some more such stuff regularly..

Hasanat Kazmi said...

Good research but this doesn't seems to work now.
"AJAX" --- i liked that :)