# OpenLayers.Layer.UTFGrid

This Layer reads from UTFGrid tiled data sources. Since UTFGrids are essentially JSON-based ASCII art with attached attributes, they are not visibly rendered. In order to use them in the map, you must add a OpenLayers.Control.UTFGrid control as well.

#### Example

>     var world_utfgrid = new OpenLayers.Layer.UTFGrid({
>         url: "/tiles/world_utfgrid/${z}/${x}/${y}.json",
>         utfgridResolution: 4,
>         displayInLayerSwitcher: false
>     );
>     map.addLayer(world_utfgrid);

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

#### Inherits from

- OpenLayers.Layer.XYZ

Summary

OpenLayers.Layer.UTFGrid | This Layer reads from UTFGrid tiled data sources.
Properties |
isBaseLayer | Default is false, as UTFGrids are designed to be a transparent overlay layer.
projection | {OpenLayers.Projection} Source projection for the UTFGrids.
useJSONP | {Boolean} Should we use a JSONP script approach instead of a standard AJAX call?
url | {String} URL tempate for UTFGrid tiles.
utfgridResolution | {Number} Ratio of the pixel width to the width of a UTFGrid data point.
tileClass | {OpenLayers.Tile} The tile class to use for this layer.
Constructor |
OpenLayers.Layer.UTFGrid | Create a new UTFGrid layer.
Functions and Properties |
createBackBuffer | The UTFGrid cannot create a back buffer, so this method is overriden.
clone | Create a clone of this layer
getFeatureInfo | Get details about a feature associated with a map location.
getFeatureId | Get the identifier for the feature associated with a map location.

### Properties

### isBaseLayer

Default is false, as UTFGrids are designed to be a transparent overlay layer.

### projection

{OpenLayers.Projection} Source projection for the UTFGrids. Default is “EPSG:900913”.

### useJSONP

{Boolean} Should we use a JSONP script approach instead of a standard AJAX call?

Set to true for using utfgrids from another server. Avoids same-domain policy restrictions. Note that this only works if the server accepts the callback GET parameter and dynamically wraps the returned json in a function call.

Default is false

### url

{String} URL tempate for UTFGrid tiles. Include x, y, and z parameters. E.g. “/tiles/${z}/${x}/${y}.json”

### utfgridResolution

{Number} Ratio of the pixel width to the width of a UTFGrid data point. If an entry in the grid represents a 4x4 block of pixels, the utfgridResolution would be 4. Default is 2 (specified in OpenLayers.Tile.UTFGrid).

### tileClass

{OpenLayers.Tile} The tile class to use for this layer. Defaults is OpenLayers.Tile.UTFGrid.

### Constructor

### OpenLayers.Layer.UTFGrid

Create a new UTFGrid layer.

#### Parameters

config | {Object} Configuration properties for the layer.

#### Required configuration properties

url | {String} The url template for UTFGrid tiles. See the url property.

### Functions and Properties

### createBackBuffer

> createBackBuffer: function()

The UTFGrid cannot create a back buffer, so this method is overriden.

### clone

> clone: function ( | obj | )

Create a clone of this layer

#### Parameters

obj | {Object} Only used by a subclass of this layer.

#### Returns

{OpenLayers.Layer.UTFGrid} An exact clone of this OpenLayers.Layer.UTFGrid

### getFeatureInfo

Get details about a feature associated with a map location. The object returned will have id and data properties. If the given location doesn’t correspond to a feature, null will be returned.

#### Parameters

location | {OpenLayers.LonLat} map location

#### Returns

{Object} Object representing the feature id and UTFGrid data corresponding to the given map location. Returns null if the given location doesn’t hit a feature.

### getFeatureId

> getFeatureId: function( | location | )

Get the identifier for the feature associated with a map location.

#### Parameters

location | {OpenLayers.LonLat} map location

#### Returns

{String} The feature identifier corresponding to the given map location. Returns null if the location doesn’t hit a feature.

Methods for coordinate transforms between coordinate systems.

> createBackBuffer: function()

The UTFGrid cannot create a back buffer, so this method is overriden.

> clone: function ( | obj | )

Create a clone of this layer

> getFeatureId: function( | location | )

Get the identifier for the feature associated with a map location.
This Control provides behavior associated with UTFGrid Layers.
The XYZ class is designed to make it easier for people who have tiles arranged by a standard XYZ grid.
Instances of OpenLayers.Tile.UTFGrid are used to manage UTFGrids.
{String} URL tempate for UTFGrid tiles.
Create a new UTFGrid layer.
This class represents a longitude and latitude pair
Close