Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Table of contents

Table of Contents

Add a WMS layer via the Google Earth user interface

Image Modified

Image Modified

Image Modified

Image Modified

Image Modified

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.

Image Modified

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

Code Block

<?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>65</north>
        <south>40</south>
        <east>15</east>
        <west>-20</west>
    </LatLonBox>
</GroundOverlay>
</kml>

The GroundOverlay is an 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 webFor a WMS the LatLonBox are in fact optional, as Google Earth will request an image for any locations, regardless of the valid range for the WMS. You can include a LatLonBox to prevent fruitless events outside the valid extent of the data, it will not be used to span the data on the globe. For WMS, the href 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.

  • Note that you need to replace all &

...

  • symbols in the url with the html encoding for

...

  • that "& a m p ;" (without spaces).
    Code Block
    
    any
    &
    should become
    &amp;
    
  • Note that the href element contains a full valid WMS url EXCEPT the bbox keyword. Google Earth will automatically use the bbox keyword depending on where you zoomed. This makes sure that you always see the WMS when you are in the correct region, and that the resolution will be better when you zoom in. Leaving out the bbox will result in an INVALID url if you open it on a browser: http://

...

...

...

...

Mastering WMS performance 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.

Image Added

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

Code Block
<?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>vaklodingenKB121_2120 wms</name>
	<description></description>
	    <name>Untitled Image Overlay</name>
    <Icon>
        	<href>http://opendapdata.ncof.deltaresco.nluk/thredds/wms/opendap/rijkswaterstaat/vaklodingen/vaklodingenKB121_2120.nc?service=WMS&amp;version=1.3.0&amp;requestMETOFFICE-NWS-AF-BIO-DAILY?VERSION=1.1.1&amp;REQUEST=GetMap&amp;bbox=4.567220799999999,52.9343465,4.7177535,53.047411499999995SRS=EPSG:4326&amp;layersWIDTH=z512&amp;formatHEIGHT=image/png512&amp;crsLAYERS=EPSG%3A4326N3n&amp;widthSTYLES=800boxfill/rainbow&amp;heightTRANSPARENT=600TRUE&amp;stylesFORMAT=boxfillimage/ferretgif&amp;COLORSCALERANGEbbox=-500,50020,40,15,65&amp;TRANSPARENT=TRUE<time=2011-04-07T12:00:00.000Z</href>
	    </Icon>
	    <LatLonBox>
        	<north>52.9343<<north>65</north>
        	<south>53.0474<<south>40</south>
        	<east>4.7178<<east>15</east>
        	<west>4.5672<<west>-20</west>
	    </LatLonBox>
</GroundOverlay>
</kml>

...



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

Mastering WMS appearance by editing a kml file

In a WMS url there are some optional argument, like time and elevation. GIS clients like Google Earth by default use the default value for these dimensions. For temporal data, usually the last time step is shown only, for instance in this WMS of the Dutch KNMI rain radar. When you edit a kml, you can insert on-default values for these parameters. In addition, you can specify better values for non-standard extensions like COLORSCALERANGE.