Google Earth and GeoServer

As some of you may know, GeoServer can serve up WMS data as KML or KMZ for Google Earth. There is a full video tutorial located here on how to set it up.

One of the tools GeoServer has to make serving up KML/KMZ easier is a reflector script. This exists so people don’t have to type in an entire WMS request URL to view the data in Google Earth. Here is an example of its use:

http://localhost:8080/geoserver/wms/kml_reflect?layers=states

By using this URL, you can ignore all the other WMS information. Information such as projection, image size, output format etc. You can also specify more than one layer by just separating the layer names with commas: layers=states,roads,lakes

The reflector will take the layer names and fill in the missing information, then return back a full WMS request. Users have asked why a URL is being returned when they use the reflector in their web browser. The reflector is meant to be used within Google Earth in a Network Link. The network link will interpret the returned WMS request and send it off again to GeoServer to get the real KML data back. So at first it makes two requests to get the real data, but after that it updates with just one get map request.

One recent item of discussion has been how to format the description of the features that are returned. In KML you can return an HTML description of the data.

ge attributes

What we do is take all of the feature information and put it into an HTML table that pops up when you click on the feature. But say if you wanted to hide some of the attribution, or turn some value into hyper links, there is no current way to do this (at least with not hacking the code). A few ideas have been suggested: including the formatting information into the SLD file, have a separate SLD-like file for just the descriptions, and XML transforms with a template document. In order to make a decision on which path to take, we would like some input from the users: use-case scenarios, requirements, etc.

So drop us a line and tell us what you think.

3 Comments

  1. jubal
    Posted January 8, 2007 at 7:56 am | Permalink

    I like the idea of having a XSLT or some other way to intercept the attributes on the server before they get written to the KML. In addition to selecting the needed attributes, its important to have some control over the formatting. If this can be done in the SLD than that is probably the way to go.

  2. Posted January 9, 2007 at 7:32 pm | Permalink

    I just added a feature request for this: http://jira.codehaus.org/browse/GEOS-836

    I’m thinking that it’d be best to use some sort of html templating to accomplish this, and we can leverage the java open source world with velocity or freemarker. I think it should be easier for people to pick up than XSLT, which can be a bit tough. Though perhaps we could make it available for power users.

    SLD wasn’t designed with real html templating in mind, but it is the logical place I believe, so if we experiment and find something good perhaps we can propose it to the OGC.

  3. Vincent Schut
    Posted January 25, 2007 at 5:36 am | Permalink

    I’d vote for XSLT. The basics are not that hard to learn, imho 🙂
    Note that any person that has been using and configuring mapbuilder a bit more extensive that just copying the examples will probably have been hacking some XSL as it’s one of the core techniques of how mapbuilder builds an displays its widgets (that’s why I learned it anyway).

Download GeoServer