Adding map server overlays on Google Earth


KML2.1 allows dynamically adding layers from ArcIMS, WMS, MapGuide to Google Earth. The method is:
1. Build a .kml file like below:
<networklink>
<name>Example of Overlays</name>
<flytoview>1</flytoview>
<link>
<href>http://156.56.104.164/GoogleCacheServer/servlet/WMSConnection?</href>
<refreshmode>onInterval</refreshmode>
<refreshinterval>30</refreshinterval>
<viewrefreshmode>onStop</viewrefreshmode>
<viewrefreshtime>7</viewrefreshtime>
<viewformat>BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth];CAMERA=\
[lookatLon],[lookatLat],[lookatRange],[lookatTilt],[lookatHeading];VIEW=\
[horizFov],[vertFov],[horizPixels],[vertPixels],[terrainEnabled]</viewformat>
</networklink>
If you specify a <viewrefreshmode> of onStop and do not include the <viewformat> tag in the file, the following information is automatically appended to the query string:
BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]
This information matches the Web Map Service (WMS) bounding box specification.Also, horizPixels and vertPixels defines the bounding box's width and height.
When load this file in Googel earth, it will make a http "get" query to the link URL you defined with the query values.
2. Then we can easy build a CGI or servlet to deal with the query string and build a wms like query string to query for the county servers layers and dynamiclly write a KML file with the layer URL back. Google earth could add the layer according to this kml file. Please note: must access to a WMS server that can output WGS84 coords (EPSG 4326).

