Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm working on a custom web-based application that generates spatial data and that includes a web-based map viewer. We have a custom servlet that handles WMS requests (not a complete WMS implementation, just enough for our needs) and uses MapServer/SWIG to generate image data. The web front end uses OpenLayers. So far, so good: everything works and gives us nice-looking interactive maps.

We also built a feature that creates a KML file with a <GroundOverlay> that refers to our WMS URL -- the user clicks a link and it opens in Google Earth and they can see the data. Again, so far, so good.

The problem comes when the user starts to tilt the camera and pan around in Google Earth. Google Earth starts mis-registering our data, at first by just a few meters at a time but eventually by tens of kilometers, if you tilt, zoom in and out, and pan around enough.

I did some searches and I found several sites that indicated that Google Earth's support for tilting WMS imagery was poor, but little in the way of specifics. Has anyone else tried this and experienced similar issues?

More importantly, how should I approach this problem? Given that our users are very interested in doing exactly this kind of exploration (plot data with topography, tilt the camera down, and fly around in our subject area) and that our users are already pretty committed to using Google Earth as the client, how should we make the data available so that they can view it?

share|improve this question
    
Google Maps uses a spherical mercator projection for speed. Maybe Google Earth does the same thing? –  Sarge Sep 21 '10 at 22:19
    
According to this page, "Google Earth uses Simple Cylindrical projection for its imagery base. This is a simple map projection where the meridians and parallels are equidistant, straight lines, with the two sets crossing at right angles. This projection is also known as Lat/Lon WGS84." –  Daniel Pryden Sep 21 '10 at 23:26
    
This is really a comment, not an answer to the question. Please use "add comment" to leave feedback for the author. –  iant Aug 14 '12 at 11:19

4 Answers 4

up vote 1 down vote accepted

I am guessing that you are trying to render a single WMS image to cover the entire view. Remember that when the image is tilted it is very difficult to render a rectangular image of the correct resolution for the entire area. Locations close to the camera need to be rendered differently to features on the horizon. Therefore, direct use of WMS is completely unsuitable for use in Google Earth and should be avoided.

The best approach is to create a network link that divides the area into a set of tiles, each with its own unique link to a fixed extent of the WMS as a Super Overlay. This allows Google Earth to decide which tiles to load and when. It will also make it much simpler to implement caching at the server end. Create larger tiles for different zoom levels using the Region tag. When the view is tilted Google Earth can use lower resolution tiles on the horizon, and higher resolution for closer areas. For an idea of a good structure try converting your data manually using the KML Super Overlay GDAL driver.

For large tiles the WMS response needs to be in WGS84 due to projection issues. For smaller tiles it is sometimes possible to use a local projection system by individually calculating the WGS84 coordinates of the tile corners. There are obvious projection issues, although the results are often better than interpolating.

share|improve this answer
    
Yes, this is basically the approach we've eventually settled on as well. –  Daniel Pryden May 19 '11 at 6:17

I have once used MapTiler with a WMS server (Maptiler is a graphical interface for gdal2tiles so the same thing should be possible with gdal2tiles, but I found it easier to experiment with a graphical interface). I haven't tried that but Maptiler offers an option to generate a KML SuperOverlay. So it might be worth to check it out.

To use MapTiler with a WMS Server you need to write an XML file which describes the WMS server (syntax is explained here) and give it as input map to MapTiler. Probably will MapTiler generate tiles and the SuperOverlay won't keep a reference to the WMS Server so it might not be exactly what you are looking for.

share|improve this answer

As @Sarge says, Google Earth uses a spherical projection. You could use the gdal2tiles utility to create the kml/kmz for you, but you still need to warp the imagery to fit, using something like gdalwarp. See step 5 of this example. Unfortunately I couldn't tell you how to integrate GDAL with your web application.

Hope this helps!

share|improve this answer
1  
Well, Google Earth will automatically warp imagery from WGS84/Simple Cylindrical to the actual globe shape, so I just need to handle warping it to WGS84, which I can do on the fly in the WMS request. But it looks like the problem is Google Earth's generic WMS support, which doesn't do a terribly good job. After some further research, it looks like a tile approach, combined with a KML "Super-Overlay", should make this work. (Which is what gdal2tiles does anyway.) –  Daniel Pryden Sep 22 '10 at 16:44

Using, OpenLayers, Google Maps API (Google Earth Mode) and GeoExt

GeoExt is the key:

Excellent Working Example:

http://dev.geoext.org/sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.html

share|improve this answer
1  
This is interesting, but it doesn't seem helpful for what I'm trying to do. My data is currently raster data (in the future, we may add vector layers, but rasters are definitely the major focus) and I think our users would prefer the standalone Google Earth client instead of using the Google Earth plug-in. I'll look into this, though. –  Daniel Pryden Sep 21 '10 at 21:49
    
you require Google Earth Pro > google.com/enterprise/earthmaps/pro_features.html#compare Import and overlay images - costs £280 ($435 USD) –  Mapperz Sep 21 '10 at 21:58
    
see ffdt.rrbdin.org/FFDT_GoogleEarth_WMS.html fly over movies –  Mapperz Sep 21 '10 at 22:00
    
I'm certain that I don't require Google Earth Pro for this, and if I did that would be a non-starter: I can't force my users to pay for the Pro upgrade. (Those users that have it will of course want to use it for its extra features, though!) But ordinary Google Earth should be perfectly capable of displaying imagery overlays using the <GroundOverlay> KML element. My issue is with trying to do a GroundOverlay that renders directly from WMS; it looks like that may not be possible. –  Daniel Pryden Sep 22 '10 at 16:48
2  
I would use SuperOverlay - paolocorti.net/2008/08/06/… is a proven method. –  Mapperz Sep 22 '10 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.