Table of contents

Add a WMS layer via the Google Earth user interface

Add a WMS layer by editing a kml file

If you save the WMS layer you created via the GUI, you can save that to a separate .kml file. IF you save as a .kmz, that is simply a zipped .kml. You can now edit the .kml in an ASCII edit such as notepad, wordpad or textpad, to see what the syntax is for showing a WMS layer in Google Earth.

Once saved, you will see that kml uses a so-called GroundOverlay element.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<GroundOverlay>
	<name>Untitled Image Overlay</name>
	<Icon>
		<href>http://data.ncof.co.uk/thredds/wms/METOFFICE-NWS-AF-BIO-DAILY?VERSION=1.1.1&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;WIDTH=512&amp;HEIGHT=512&amp;LAYERS=N3n&amp;STYLES=boxfill/rainbow&amp;TRANSPARENT=TRUE&amp;FORMAT=image/gif&amp;</href>
		<viewRefreshMode>onStop</viewRefreshMode>
		<viewBoundScale>0.75</viewBoundScale>
	</Icon>
	<LatLonBox>
		<north>66.22176887010372</north>
		<south>25.35615986229249</south>
		<east>314.0583306192361</east>
		<west>45.71559353826041</west>
	</LatLonBox>
</GroundOverlay>
</kml>

The GroundOverlay is en element that positions any image on the globe by describing its bounding boxes. The image can be a local image, one that you saved to your local harddisk, or a image on the web. For WMS, the image is actually generated on the fly, using a a very long url. We explain the construction of this url on a separate wms primer.

http://data.ncof.co.uk/thredds/wms/METOFFICE-NWS-AF-BIO-DAILY?VERSION=1.1.1&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;WIDTH=512&amp;HEIGHT=512&amp;LAYERS=N3n&amp;STYLES=boxfill/rainbow&amp;TRANSPARENT=TRUE&amp;FORMAT=image/gif&amp;

Mastering WMS layer by editing a kml file

With the previous manual editing of kml files, you can add any WMS to your Google Earth. However, often you will not see nice WMS images, but a 'request in progress' arrow.

You can prevent this by switching of the automatic updating of WMS, and simply download the WMS image and refer to a local file, or use WMS as a means to refer to images as if they were static images on the web. You can do this by making sure

http://data.ncof.co.uk/thredds/wms/METOFFICE-NWS-AF-BIO-DAILY?VERSION=1.1.1&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;WIDTH=512&amp;HEIGHT=512&amp;LAYERS=N3n&amp;STYLES=boxfill/rainbow&amp;TRANSPARENT=TRUE&amp;FORMAT=image/gif&amp;bbox=-10.,50.,10,60.

Note that the WMS image still need to be request once, so initially you still see the 'request in progress' arrow. IF you wan tto reuse the image, you can also request the image yourselves in a web browser, save it, and point to it locally.

\My Document\downloaded_image.png