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

Summary
OpenLayers.Layer.UTFGridThis Layer reads from UTFGrid tiled data sources.
Properties
isBaseLayerDefault is false, as UTFGrids are designed to be a transparent overlay layer.
projection{OpenLayers.Projection} Source projection for the UTFGrids.
url{String} URL tempate for UTFGrid tiles.
utfgridResolution{Number} Ratio of the pixel width to the width of a UTFGrid data point.
Constructor
OpenLayers.Layer.UTFGridCreate a new UTFGrid layer.
Functions and Properties
cloneCreate a clone of this layer
getFeatureInfoGet details about a feature associated with a map location.
getFeatureIdGet 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”.

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).

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

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.
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