class cgxp.plugins.AddKMLFile(config)

This plugin provides an “Add KML File” button that can be used to add a local KML file to both the 2D map and 3D Google Earth Plugin view (if present). As most browsers do not permit Javascript to read local files, this requires an “echo” service to be running on the server that reflects a file back to the client.

Beware that the plugin may behave incorrectly (ie. not showing) if nested in a panel not visible at application launch. For example, the button may not show up if put in collapsed panel in an accordion.

The following configuration example is known to work well:

new gxp.Viewer({
    portalConfig: {
        items: [
                layout: "accordion",
                id: "left-panel",
                region: "west",
                width: 300,
                minWidth: 300,
                split: true,
                collapseMode: "mini",
                border: false,
                defaults: {width: 300},
                items: [{
                    xtype: "panel",
                    title: OpenLayers.i18n("layertree"),
                    id: 'layerpanel',
                    layout: "vbox",
                    bbar: [],
                    layoutConfig: {
                        align: "stretch"
    tools: [
             ptype: "cgxp_addkmlfile",
             echoUrl: "http://path/to/echo/service",
             actionTarget: "layerpanel.bbar"

Example Use

Sample code showing how to add an AddKMLFile plugin to a gxp.Viewer is available in the GoogleEarthView plugin.

Config Options

Configuration properties.


Object Config object for the action created by this plugin.


Boolean Enable or disable GoogleEarthView plugin auto-loading.

default to false


String The “add kml” button text (i18n).


String The “echo” service URL.


String A reference id to the GoogleEarthView plugin, mandatory if you want to auto-load that plugin when loading a kml file.


String The “wait while loading” message text (i18n).

Table Of Contents

Previous topic


Next topic


This Page

Fork me on GitHub