Linking Geoserver WMS layer to Google Earth?

Instead of creating a KML file then using that to access Google Earth, you can instead add your GeoServer WMS directly as an overlay as below:

  • From the menu select Add,
  • select Image Overlay,
    • give the overlay a name
  • select the Refresh tab
  • select WMS Parameters
  • select the Add button next to 'WMS Server:' drop down
    • Add the URL to your service (without parameters) for example something like: http://ogc.bgs.ac.uk/cgi-bin/BGS_BGS-HPA_Radon_Potential/ows? (See attached image)
    • Click OK
    • Select the layer you want to show on the map from the list of Transparent layers in the left hand side and add them to the list of Selected layers on the right hand side.
    • Click OK
  • Now in the 'New Image Overlay' window you will see that the Link section has been filled out to give you something like the below string, which is the request that Google Earth will send to your GeoServer WMS server without the BoundingBox details:
    • http://ogc.bgs.ac.uk/cgi-bin/BGS_BGS-HPA_Radon_Potential/ows?language=eng&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&WIDTH=512&HEIGHT=512&LAYERS=GBR_BGS-HPA_625K_RADON_POTENTIAL&STYLES=default&TRANSPARENT=TRUE&FORMAT=image/gif
  • To get Google Earth to request a png instead of a gif change the FORMAT=image/gif parameter value to FORMAT=image/png
  • Click OK

That's it

Google Earth pop-up windows showing how to add a WMS URL for use as Image Overlay

The above example use a MapServer WMS service but it's no different from a GeoServer WMS.

Let's look at the GeoServer WMS service provided by the Delaware Geological Survey

A GetCapabilities request has a URL like:

http://maps.dgs.udel.edu:80/geoserver/DGS_Surficial_and_Contact_Geology/wms?SERVICE=WMS&request=GetCapabilities&

Some example GetMap requests are:

http://maps.dgs.udel.edu/geoserver/DGS_Surficial_and_Contact_Geology/wms?service=WMS&TRANSPARENT=TRUE&version=1.3.0&request=GetMap&EXCEPTIONS=INIMAGE&FORMAT=image/png&CRS=EPSG%3A4326&BBOX=39.57931760121924,-75.79289049774037,39.784397224903465,-75.45691470533502&WIDTH=1250&HEIGHT=763&LAYERS=US-DE_DGS_100k_Surficial_Geology&STYLES=&

http://maps.dgs.udel.edu/geoserver/DGS_Surficial_and_Contact_Geology/wms?service=WMS&TRANSPARENT=TRUE&version=1.3.0&request=GetMap&EXCEPTIONS=INIMAGE&FORMAT=image/png&CRS=EPSG%3A4326&BBOX=39.57931760121924,-75.79289049774037,39.784397224903465,-75.45691470533502&WIDTH=1250&HEIGHT=763&SLD=http%3A%2F%2Fogc.bgs.ac.uk%2Fsld%2Fgeoserver-style-test-no-named-style1.sld&layers=US-DE_DGS_100k_Surficial_Geology&

You can click on these GetMap links and they will show you some maps in your browser.

When we want to see the the Delaware maps in Google earth, using the above procedure, we just specify the part of the above URLS up to and including the question mark. This part of the URL is known as the service end point.

That is, in this example:

http://maps.dgs.udel.edu/geoserver/DGS_Surficial_and_Contact_Geology/wms?

When we add this URL to the dialogue and then select the Geology layer we get the below map within Google Earth.

Delaware geology in Google Earth served by GeoServer WMS


In addition to the extremely helpful and very clear explanation from nmtoken, I found it helpful to adjust the View-Based Refresh settings to 1 second and a View Bound Scale of 1.5. This didn't eat up much more resource, and it made slight adjustments in the viewport less tiresome.

Edit: My image quality was much poorer in Google Earth than the same service in QGIS. I found this article, https://productforums.google.com/forum/#!topic/maps/qmokppwDjvU;context-place=topicsearchin/maps/category$3Adesktop-app%7Csort:relevance%7Cspell:false, that instructed how to improve resolution by editing the Image Overlay Link Address from: http://yadayada=EPSG:4326&WIDTH=516&HEIGHT=516&LAYERS=yadayada to: http://yadayada=EPSG:4326&WIDTH=1920&HEIGHT=1920&LAYERS=yadayada


@nmtoken rescued my favorite Google Earth web service!