Class: UTFGrid

ol/source/UTFGrid~UTFGrid


import UTFGrid from 'ol/source/UTFGrid';

Layer source for UTFGrid interaction data loaded from TileJSON format.

new UTFGrid(options)

source/UTFGrid.js, line 273
Name Type Description
options

Source options.

Name Type Default Description
preemptive boolean true

If true the UTFGrid source loads the tiles based on their "visibility". This improves the speed of response, but increases traffic. Note that if set to false, you need to pass true as opt_request to the forDataAtCoordinateAndResolution method otherwise no data will ever be loaded.

jsonp boolean false

Use JSONP with callback to load the TileJSON. Useful when the server does not support CORS..

tileJSON tileJSON

TileJSON configuration for this source. If not provided, url must be configured.

url string

TileJSON endpoint that provides the configuration for this source. Request will be made through JSONP. If not provided, tileJSON must be configured.

Methods

forDataAtCoordinateAndResolution(coordinate, resolution, callback, opt_request)

source/UTFGrid.js, line 380

Calls the callback (synchronously by default) with the available data for given coordinate and resolution (or null if not yet loaded or in case of an error).

Name Type Description
coordinate module:ol/coordinate~Coordinate

Coordinate.

resolution number

Resolution.

callback function

Callback.

request boolean

If true the callback is always async. The tile data is requested if not yet loaded.

getTemplate(){string|undefined}

source/UTFGrid.js, line 364

Return the template from TileJSON.

Returns:
The template from TileJSON.