Geoportal Extension for OpenLayers API Reference

Class: GetFeatureInfo

ol.control.GetFeatureInfo

OpenLayers Control to manage getFeatureInfo capability. All queryable layers can be requested.
For the vector objects the information displayed are the objects properties. For the wms and wmts layers
this is the response of the getFeatureInfo request which is shown to the user.

new GetFeatureInfo(gfiOptions)

OpenLayers/Controls/GetFeatureInfo.js, line 37
Name Type Description
gfiOptions Object

control options

Name Type Description
layers Array.<Object> optional

list of layers which can be requested through the control. Each array element is an object, with following properties :

Name Type Description
obj ol.layer.Layer

ol.layer.Layer layer handled by the control (that has been added to map).

event String optional

name of the mouse event triggering getFeatureInfo on this layer (that has been added to map). allowed values are : 'singleclick', 'dblclick' and 'contextmenu'. If not specified the triggering event is the current default event (see gfiOptions.options.defaultEvent).

infoFormat String optional

indicates the format mime-type of the response of GetFeatureInfo requests.

options Object optional

custom options object to configure the control, with following properties :

Name Type Default Description
hidden Boolean false optional

specifies if the widget should be hidden.

auto Boolean false optional

specifies if the control run in automatic mode. In automatic mode all vector layers added on run time or added at map initialization can be requested through the control. The triggering event of those layers is the default event.

active Boolean true optional

specifies if the control is active or inactive. In inactive mode requests are not fired and no information are displayed.

defaultEvent String 'singleclick' optional

default triggering event chosen in the list ('singleclick', 'dblclick', 'contextmenu'). This is the triggering event of all layers added to the control without configured triggering event.

defaultInfoFormat String 'text/html' optional

indicates the default format mime-type of the response of GetFeatureInfo requests.

cursorStyle String 'pointer' optional

specifies the type of cursor to be displayed when pointing on vector feature of a layer previously added to the control. The value must be choosen in the possible values of the css cursor property.

proxyUrl String optional

Proxy URL to avoid cross-domain problems.

noProxyDomains Array.<String> optional

Proxy will not be used for this list of domain names. Only use if you know what you're doing.

autoPan Boolean true optional

Specifies whether the map should auto-pan if the pop-up is rendered outside of the canvas. Defaults to true.

autoPanAnimation olx.OverlayPanOptions optional

Used to customize the auto-pan animation. See olx.OverlayPanOptions.

autoPanMargin Number optional

Margin (in pixels) between the pop-up and the border of the map when autopanning. Default is 20.

Extends

  • ol.control.Control

Methods

getLayers(){Array.<Object>}

OpenLayers/Controls/GetFeatureInfo.js, line 286

Gets the list of layers already added to the map and attached to the control.

Returns:
Name Type Description
gfiLayers Array.<Object> List of layers.
Name Type Description
obj ol.layer.Layer ol.layer.Layer layer handled by the control (that has been added to map).
event String Optional. Name of the mouse event triggering getFeatureInfo on this layer (that has been added to map). allowed values are : 'singleclick', 'dblclick' and 'contextmenu'.
infoFormat String Optional. Indicates the format mime-type of the response of GetFeatureInfo requests.

isActive(){Boolean}

OpenLayers/Controls/GetFeatureInfo.js, line 369

Gets active control property

isHidden(){Boolean}

OpenLayers/Controls/GetFeatureInfo.js, line 387

Indicates if the widget is hidden

Returns:
hidden

setActive(active)

OpenLayers/Controls/GetFeatureInfo.js, line 335

Sets active control property

Name Type Description
active Boolean

specify the value the active property must be set to.

setCursorStyle(cursorStyle)

OpenLayers/Controls/GetFeatureInfo.js, line 315

Sets the cursor style when hovering vector layers features.

Name Type Description
cursorStyle String

cursor style. The value must be choosen in the possible values of the css cursor property.

setDefaultEvent(eventName)

OpenLayers/Controls/GetFeatureInfo.js, line 296

Sets the default event applied to layer with no triggering event configured.
This can be set on run time.

Name Type Description
eventName String

name of the mouse event chosen in the list : 'singleclick', 'dblclick', 'contextmenu'.

setHidden(hidden)

OpenLayers/Controls/GetFeatureInfo.js, line 378

Hides/displays widget

Name Type Description
hidden Boolean

specify if the widget must be hidden

setLayers(gfiLayers)

OpenLayers/Controls/GetFeatureInfo.js, line 399

Set the layers list the control is attached to. Listened events are updated according to this list.

Name Type Description
gfiLayers Array.<Object>

list of layers which can be requested through the control.

Name Type Description
obj ol.layer.Layer

ol.layer.Layer layer handled by the control (that has been added to map).

event String optional

Name of the mouse event triggering getFeatureInfo on this layer (that has been added to map). allowed values are : 'singleclick', 'dblclick' and 'contextmenu'.

infoFormat String optional

Indicates the format mime-type of the response of GetFeatureInfo requests.

setMap(map)

OpenLayers/Controls/GetFeatureInfo.js, line 209

Binds map to control.

Name Type Description
map ol.Map

Map.