1

I would like to customize the KML that is exported from Geoserver (2.5). Specifically, I would like to add a "name" tag under the "Document" tag and add an arbitrary number of "Folder" and "name" tags. The reason for this is to provide a hierarchal structure when the KML file is represented in a table of contents tree.

For example, I would like to customize the exported KML file to contain:

<kml>
    <Document>
        <name>Great Places</name>
        <Folder>
            <name>Heaven</name>
            <Folder>
                <name>The Garden Of Earthy Delights</name>
                .
                .
                .
            </Folder>
        </Folder>
    </Document>
</kml>

Right now I only get this:

<kml>
    <Document>
        <Folder>
            <name>...</name>
            .
            .
            .
        </Folder>
    </Document>
</kml>

Can someone point me in the right direction?

1

GeoServer 2.5 does not provide out of the box any way to customize the KML generated code, if you are stuck with it you can maybe put in front some proxy using XSLT to alter the returned KML.

If you can upgrade GeoServer to the latest version (2.12.x), and can write Java code, then there is a pluggable mechanism that allows you to plug in a decorator that can alter the generated KML to some extent. See these pointers to get started:

  • Thank you for the response Andrea. In anticipation of not being able to customize the KML export within Geoserver, I had already started on the path you mentioned in your first paragraph. I created a JEE Filter that acts upon the Geoserver response and it invokes a DOM-based transformer that provides the desired KML output. For future use, your other points about the Geoserver 2.12.x decorator capability will be kept in mind. – RLR Dec 18 '17 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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