cgxp.plugins.WFSGetFeature

ptype
cgxp_wfsgetfeature
class cgxp.plugins.WFSGetFeature(config)

This plugin adds a toggle button to a toolbar. When the button is pressed the map changes to “query” mode - user can click and draw boxes to query the map. WFS GetFeature is used for queries.

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 WFSGetFeature plugin to a gxp.Viewer:

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

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.

actionTarget

Object or String or Array Where to place the tool’s actions (e.g. buttons or menus)?

In case of a string, this can be any string that references an Ext.Container property on the portal, or a unique id configured on a component.

In case of an object, the object has a “target” and an “index” property, so that the tool can be inserted at a specified index in the target.

actionTarget can also be an array of strings or objects, if the action is to be put in more than one place (e.g. a button and a context menu item).

To reference one of the toolbars of an Ext.Panel, ”.tbar”, ”.bbar” or ”.fbar” has to be appended. The default is “map.tbar”. The viewer’s main MapPanel can always be accessed with “map” as actionTarget. Set to null if no actions should be created.

Some tools provide a context menu. To reference this context menu as actionTarget for other tools, configure an id in the tool’s outputConfig, and use the id with ”.contextMenu” appended. In the snippet below, a layer tree is created, with a “Remove layer” action as button on the tree’s top toolbar, and as menu item in its context menu:

{
    xtype: "gxp_layertree",
    outputConfig: {
        id: "tree",
        tbar: []
    }
}, {
    xtype: "gxp_removelayer",
    actionTarget: ["tree.tbar", "tree.contextMenu"]
}

If a tool has both actions and output, and you want to force it to immediately output to a container, set actionTarget to null. If you want to hide the actions, set actionTarget to false. In this case, you should configure a defaultAction to make sure that an action is active.

clickTolerance

Integer Buffer around clicked point, in pixels.

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.

options

Object Actions options

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.

WFSURL

String The mapserver proxy URL

Public Methods

Public methods.

WFSGetFeature.addActions()

Table Of Contents

Previous topic

cgxp.plugins.ThemeSelector

Next topic

cgxp.plugins.WFSPermalink

This Page