Wednesday, May 02, 2007

Our Grid-oriented Map Servers vs. Google Map Servers


Question: How are you different from Google Maps?
Can you use only Google maps (without any mediators) in Geo-Science Applications?



Google Map Services enables navigating into an Earth framework for map/satellite display in images and applying dynamic browser based geo-processing services.

Instead of competing, Google Map provides complementary services and layers to our integration framework. We use its earth map/satellite images as Layer-Set 1 (see my previous posts) to create more comprehensible map images in our integration framework.

We mostly deal with the performance issues at Layer set 2.Google Map and NASA OnEarth WMS map servers provide layer set 1 in tolerable performance level.

Our main focus is integrating Mapping Services with Geo-science grids . Outcomes of these integration is three layer structured map images. Geo-Science applications use scientific data (geo-data, spatial data) provided by different vendors in differetn format. Because of this, we mainly deal with the interoperability of services and data. In order to solve the data interoperability problem we use OGC defined standard GML specifications. GML is XML encoding of the scientific vector data. Using XML causes performance problems which is not related to the problems Google people deal with such as ransferring parsing rendering and displaying XML based large data (GB in size).

Actually Google enables overlaying vector data (Layer-Set 2) over their satellite images or maps but when you tried to use Google map API with geo-science any XML encoded science data system will be stuck. it is because of that Google map API uses DOM parsers. DOM enables parsing XML documents of limited sizes.




How Google Map Server works:

Here, I summarized their approach. You can find more detailed architecture description on the web.
----------------------------------------------------------------------------------
Google cut the whole world's satellite image into pieces and call them tiles. The vital question is how to formulate the accepted requests and regions composed of tiles. Google Map provides two different maps, (1) Google maps and (2) Google satellite images.


1. Google Maps:

They use three parameters, xcoord, ycoord and zoom factor to formulate requests and regions.

A sample request to mt1 server at zoom level 9:
http://mt1.google.com/mt?n=404&v=w2.12&x=130&y=93&zoom=9

Zoom factor gets values from 17 (fully zoomed out) to 0 (maximum definition).
x coordinate takes values from -90 to 90
y coordinate takes values from -180 to 180

At a factor 17, the whole earth is in one tile where x=0 and y=0. At a factor 16, the earth is divided in 2x2 parts, where 0<=x<=1 and 0<=y<=1. and at each zoom step, each tile is divided into 4 parts. So at a zoom factor Z, the number of horizontal and vertical tiles is 2^(17-z)

Google uses 4 servers to balance the load. these are mt0, mt1, mt2 and mt3. And each tile is a 256X256 png picture.


To find a tile from the cached tiles:

latitude=90-latitude;
longitude=180+longitude;

double latTileSize=180/(pow(2,(17-zoom)));
double longTileSize=360/(pow(2,(17-zoom)));

//Tile coordinates:
int tilex=(int)(longitude/longTileSize);
int tiley=(int)(latitude/latTileSize);


(2) Google Satellite Images:

A sample request to kh0 server at zoom level 6:
http://kh0.google.com/kh?n=404&v=8&amp;amp;amp;amp;amp;t=trtqtt

the length of parameter t defines the zoom level.

To see the whole globe, just use 't=t'. This gives a single tile representing the earth. For the next zoom level, this tile is divided into 4 quadrants, called, clockwise from top left : 'q' 'r' 's' and 't'. To see a quadrant, just append the letter of that quadrant to the image you are viewing. For example :'t=tq' will give the upper left quadrant of the 't' image. And so on at each zoom level...

Google uses 4 servers to balance the load. these are kh0, kh1, kh2 and kh3. And each tile is a 256X256 png picture.

To find a tile from the cached tiles:

double xmin=-180; double xmax=180;
double ymin=-90; double ymax=90;
double xmid=0; double ymid=0;

string location="t";

//google use a latitude divided by 2;
double halflat = latitude / 2;
for (int i = 0; i < zoom; i++)
{
xmoy = (xmax + xmin) / 2;
ymoy = (ymax + ymin) / 2;
if (halflat > ymoy) //upper part (q or r)
{
ymin = ymoy;
if (longitude < xmoy)
{ /*q*/
location+= "q";
xmax = xmoy;
}
else
{/*r*/
location+= "r";
xmin = xmoy;
}
}
else //lower part (t or s)
{
ymax = ymoy;
if (longitude < xmoy)
{ /*t*/
location+= "t";
xmax = xmoy;
}
else
{/*s*/
location+= "s";
xmin = xmoy;
}
}
}

No comments: