cgxp.plugins.GetFeature

ptype
cgxp_wfsgetfeature
class cgxp.plugins.GetFeature(config)

With this plugin we can query the map with a simple click (WMS GetFeatureInfo) or with a CTRL-Drag for a box query (WFS GetFeature). We can optionally (with actionTarget) add a toggle button to a toolbar to do a box query without the pressing the CTRL.

Only the currently visible layers are queried.

For a WMS layer the feature types sent in the WFS GetFeature query are obtained from its layers parameter.

For a layer of another type (layer that does not have a layers parameter), the feature types are obtained from the layer’s queryLayers option if it is defined, and from its mapserverLayers option if queryLayers is not defined.

Here’s an example on how to use the queryLayers option in a layer config:

...
queryLayers: [{
    name: "buildings",
    maxResolutionHint: 6.6145797614602611
}, {
    name: "parcels",
    maxScaleDenominator: 10000
}]
...

Example Use

Sample code showing how to add a GetFeature plugin to a gxp.Viewer:

new gxp.Viewer({
    ...
    tools: [{
        ptype: "cgxp_getfeature",
        actionTarget: "center.tbar",
        toggleGroup: "maptools",
        events: EVENTS,
        themes: THEMES,
        mapserverURL: "${request.route_url('mapserverproxy', path='')}",
        WFSTypes: ${WFSTypes | n},
        externalWFSTypes: ${externalWFSTypes | n},
        enableWMTSLayers: true
    }]
    ...
});

The min/maxResolutionHint can be computed with the following rule:

1 / (1 / MIN/MAXSCALEDENOMINATOR * INCHES_PER_UNIT * DOTS_PER_INCH)
1 / (1 / 25000 * 39.3701 * 96)

Or you can use min/maxScaleDenominator as set in MapServer.

Config Options

Configuration properties.

actionOptions

Object Action options

actionTarget

String or Null Where to place the optional tool’s actions.

activateToggleGroup

String The name of the activate toggle group this tool is in. Default is “clickgroup”.

autoDeactivate

Boolean Deactivate the tool after query. Default is true.

enableWMTSLayers

Boolean If true, WMTS layers will be queried as well.

events

Object An Observer used to send events.

externalWFSTypes

Array The queryable type on the parent server.

geometryName

String The geometry name.

mapserverURL

String The mapserver proxy URL

themes

Object List of internal and external themes and layers. (The same object as that passed to the cgxp.plugins.LayerTree).

toggleGroup

String If this tool should be radio-button style toggled with other tools, this string is to identify the toggle group.

WFSTypes

Array The queryable type on the internal server.

Public Methods

Public methods.

GetFeature.addActions()

Table Of Contents

Previous topic

cgxp.plugins.Geonames

Next topic

cgxp.plugins.GoogleEarthView

This Page