OpenLayers.Control.UTFGrid - OpenLayers

# OpenLayers.Control.UTFGrid

This Control provides behavior associated with UTFGrid Layers. These ‘hit grids’ provide underlying feature attributes without calling the server (again). This control allows Mousemove, Hovering and Click events to trigger callbacks that use the attributes in whatever way you need.

The most common example may be a UTFGrid layer containing feature attributes that are displayed in a div as you mouseover.

#### Example Code

>     var world_utfgrid = new OpenLayers.Layer.UTFGrid(
>         'UTFGrid Layer',
>         "http://tiles/world_utfgrid/${z}/${x}/${y}.json"
>     );
>     map.addLayer(world_utfgrid);

>     var control = new OpenLayers.Control.UTFGrid({
>         layers: [world_utfgrid],
>         handlerMode: 'move',
>         callback: function(infoLookup) {
>             // do something with returned data

>         }
>     })

#### Inherits from

- OpenLayers.Control

Summary

OpenLayers.Control.UTFGrid | This Control provides behavior associated with UTFGrid Layers.
Properties |
autoActivate | {Boolean} Activate the control when it is added to a map.
Layers | List of layers to consider.
handlerMode | Defaults to ‘click’.
Functions |
setHandler | sets this.handlerMode and calls resetHandler()
Constructor |
<OpenLayers.Control.UTFGrid> |
Functions |
callback | Function to be called when a mouse event corresponds with a location that includes data in one of the configured UTFGrid layers.

### Properties

### autoActivate

{Boolean} Activate the control when it is added to a map. Default is true.

### Layers

List of layers to consider. Must be Layer.UTFGrids `null` is the default indicating all UTFGrid Layers are queried. {Array} OpenLayers.Layer.UTFGrid

### handlerMode

Defaults to ‘click’. Can be ‘hover’ or ‘move’.

### Functions

### setHandler

> setHandler: function( | hm | )

sets this.handlerMode and calls resetHandler()

#### Parameters

hm | {String} Handler Mode string; ‘click’, ‘hover’ or ‘move’.

### Constructor

### <OpenLayers.Control.UTFGrid>

#### Parameters

options | {Object}

### Functions

### callback

> callback: function( | infoLookup | )

Function to be called when a mouse event corresponds with a location that includes data in one of the configured UTFGrid layers.

#### Parameters

infoLookup | {Object} Keys of this object are layer indexes and can be used to resolve a layer in the map.layers array. The structure of the property values depend on the data included in the underlying UTFGrid and may be any valid JSON type.

> setHandler: function( | hm | )

sets this.handlerMode and calls resetHandler()

> callback: function( | infoLookup | )

Function to be called when a mouse event corresponds with a location that includes data in one of the configured UTFGrid layers.
Controls affect the display or behavior of the map.
This Layer reads from UTFGrid tiled data sources.
Close