# OpenLayers.Control.WMTSGetFeatureInfo

The WMTSGetFeatureInfo control uses a WMTS query to get information about a point on the map. The information may be in a display-friendly format such as HTML, or a machine-friendly format such as GML, depending on the server’s capabilities and the client’s configuration. This control handles click or hover events, attempts to parse the results using an OpenLayers.Format, and fires a ‘getfeatureinfo’ event for each layer queried.

#### Inherits from

- OpenLayers.Control

Summary

OpenLayers.Control.WMTSGetFeatureInfo | The WMTSGetFeatureInfo control uses a WMTS query to get information about a point on the map.
Properties |
hover | {Boolean} Send GetFeatureInfo requests when mouse stops moving.
requestEncoding | {String} One of “KVP” or “REST”.
drillDown | {Boolean} Drill down over all WMTS layers in the map.
maxFeatures | {Integer} Maximum number of features to return from a WMTS query.
clickCallback | {String} The click callback to register in the {OpenLayers.Handler.Click} object created when the hover option is set to false.
layers | {Array(OpenLayers.Layer.WMTS)} The layers to query for feature info.
queryVisible | {Boolean} Filter out hidden layers when searching the map for layers to query.
infoFormat | {String} The mimetype to request from the server
vendorParams | {Object} Additional parameters that will be added to the request, for WMTS implementations that support them.
format | {OpenLayers.Format} A format for parsing GetFeatureInfo responses.
formatOptions | {Object} Optional properties to set on the format (if one is not provided in the format property.
handlerOptions | {Object} Additional options for the handlers used by this control, e.g.
handler | {Object} Reference to the OpenLayers.Handler for this control
hoverRequest | {OpenLayers.Request} contains the currently running hover request (if any).
events | {OpenLayers.Events} Events instance for listeners and triggering control specific events.
pending | {Number} The number of pending requests.
Constructor |
<OpenLayers.Control.WMTSGetFeatureInfo> |
Functions |
getInfoForClick | Called on click
getInfoForHover | Pause callback for the hover handler
cancelHover | Cancel callback for the hover handler
findLayers | Internal method to get the layers, independent of whether we are inspecting the map or using a client-provided array
buildRequestOptions | Build an object with the relevant options for the GetFeatureInfo request.
request | Sends a GetFeatureInfo request to the WMTS
handleResponse | Handler for the GetFeatureInfo response.

### Properties

### hover

{Boolean} Send GetFeatureInfo requests when mouse stops moving. Default is false.

### requestEncoding

{String} One of “KVP” or “REST”. Only KVP encoding is supported at this time.

### drillDown

{Boolean} Drill down over all WMTS layers in the map. When using drillDown mode, hover is not possible. A getfeatureinfo event will be fired for each layer queried.

### maxFeatures

{Integer} Maximum number of features to return from a WMTS query. This sets the feature_count parameter on WMTS GetFeatureInfo requests.

### clickCallback

{String} The click callback to register in the {OpenLayers.Handler.Click} object created when the hover option is set to false. Default is “click”.

### layers

{Array(OpenLayers.Layer.WMTS)} The layers to query for feature info. If omitted, all map WMTS layers will be considered.

### queryVisible

{Boolean} Filter out hidden layers when searching the map for layers to query. Default is true.

### infoFormat

{String} The mimetype to request from the server

### vendorParams

{Object} Additional parameters that will be added to the request, for WMTS implementations that support them. This could e.g. look like

>     {
>         radius: 5
>     }

### format

{OpenLayers.Format} A format for parsing GetFeatureInfo responses. Default is OpenLayers.Format.WMSGetFeatureInfo.

### formatOptions

{Object} Optional properties to set on the format (if one is not provided in the format property.

### handlerOptions

{Object} Additional options for the handlers used by this control, e.g.

>     {
>         "click": {delay: 100},
>         "hover": {delay: 300}
>     }

### handler

{Object} Reference to the OpenLayers.Handler for this control

### hoverRequest

{OpenLayers.Request} contains the currently running hover request (if any).

### events

{OpenLayers.Events} Events instance for listeners and triggering control specific events.

#### Register a listener for a particular event with the following syntax

>     control.events.register(type, obj, listener);

#### Supported event types (in addition to those from OpenLayers.Control.events)

beforegetfeatureinfo | Triggered before each request is sent. The event object has an xy property with the position of the mouse click or hover event that triggers the request and a layer property referencing the layer about to be queried. If a listener returns false, the request will not be issued.
getfeatureinfo | Triggered when a GetFeatureInfo response is received. The event object has a text property with the body of the response (String), a features property with an array of the parsed features, an xy property with the position of the mouse click or hover event that triggered the request, a layer property referencing the layer queried and a request property with the request itself. If drillDown is set to true, one event will be fired for each layer queried.
exception | Triggered when a GetFeatureInfo request fails (with a status other than 200) or whenparsing fails. Listeners will receive an event with request, xy, and layer properties. In the case of a parsing error, the event will also contain an error property.

### pending

{Number} The number of pending requests.

### Constructor

### <OpenLayers.Control.WMTSGetFeatureInfo>

#### Parameters

options | {Object}

### Functions

### getInfoForClick

> getInfoForClick: function( | evt | )

Called on click

#### Parameters

evt | {OpenLayers.Event}

### getInfoForHover

> getInfoForHover: function( | evt | )

Pause callback for the hover handler

#### Parameters

evt | {Object}

### cancelHover

> cancelHover: function()

Cancel callback for the hover handler

### findLayers

> findLayers: function()

Internal method to get the layers, independent of whether we are inspecting the map or using a client-provided array

### buildRequestOptions

> buildRequestOptions: function( | layer,
> | xy | )

Build an object with the relevant options for the GetFeatureInfo request.

#### Parameters

layer | {OpenLayers.Layer.WMTS} A WMTS layer.
xy | {OpenLayers.Pixel} The position on the map where the mouse event occurred.

### request

> request: function( | xy,
> | options | )

Sends a GetFeatureInfo request to the WMTS

#### Parameters

xy | {OpenLayers.Pixel} The position on the map where the mouse event occurred.
options | {Object} additional options for this method.

#### Valid options

- hover {Boolean} true if we do the request for the hover handler

### handleResponse

> handleResponse: function( | xy,
> | request,
> | layer | )

Handler for the GetFeatureInfo response.

#### Parameters

xy | {OpenLayers.Pixel} The position on the map where the mouse event occurred.
request | {XMLHttpRequest} The request object.
layer | {OpenLayers.Layer.WMTS} The queried layer.

A handler for mouse clicks.
Instances of the WMTS class allow viewing of tiles from a service that implements the OGC WMTS specification version 1.0.0.
Base class for format reading/writing a variety of formats.
{OpenLayers.Format} A format for parsing GetFeatureInfo responses.
Base class to construct a higher-level handler for event sequences.
The OpenLayers.Request namespace contains convenience methods for working with XMLHttpRequests.

> getInfoForClick: function( | evt | )

Called on click

> getInfoForHover: function( | evt | )

Pause callback for the hover handler

> cancelHover: function()

Cancel callback for the hover handler

> findLayers: function()

Internal method to get the layers, independent of whether we are inspecting the map or using a client-provided array

> buildRequestOptions: function( | layer,
> | xy | )

Build an object with the relevant options for the GetFeatureInfo request.

> request: function( | xy,
> | options | )

Sends a GetFeatureInfo request to the WMTS

> handleResponse: function( | xy,
> | request,
> | layer | )

Handler for the GetFeatureInfo response.
Controls affect the display or behavior of the map.
Class to read GetFeatureInfo responses from Web Mapping Services
{OpenLayers.Events} Events instance for listeners and triggering control specific events.
Utility functions for event handling.
This class represents a screen coordinate, in x and y coordinates
Close