mapp.layer.formats.mvt()

This module defines the MVT (MapBox Vector Tile) format for map layers.

Requires

Methods

(inner) MVT(layer) → {layer}

The MVT format method receives a JSON layer argument from the mapp.layer.decorator and assigns format specific functions to the layer object.

The SRID of an MVT layer must be 3857.

The MVT format method will call the styleParser to check the layer.style{} configuration.

A layer.reload() method will be assigned to reload the layer data from rest.

A layer.featureSource will be assigned for feature geometries.

A layer.source will be assigned for render features.

Parameters:
NameTypeDescription
layerlayer

JSON layer

Properties
NameTypeAttributesDescription
layer.paramsObject<optional>

Parameter for layer data queries.

layer.transitionnumber<optional>

The transition duration for the layer.

layer.wkt_propertiesboolean<optional>

A flag whether feature properties should be loaded independent from MVT geometries.

layer.cacheSizenumber<optional>

The cache size for the layer tiles.

Returns:

layer decorated with format methods.

Type: 
layer

(inner) reload(callbackopt)

The reload method executes the wktPropertiesLoad method for MVT layer with wkt_properties features.

Otherwise the source and featureSource Openlayers VectorTile sources are cleared and refreshed.

Finally the optional callback function param will be executed if provided.

Parameters:
NameTypeAttributesDescription
callbackfunction<optional>

Optional callback function.

(inner) tileUrlFunction(layer) → {function}

Returns a function that generates the tile URL to request an MVT tile with MVT geometries and properties required for theming.

Parameters:
NameTypeDescription
layerlayer

A decorated format:mvt mapp layer.

Returns:

A function that generates the tile URL for a given tile coordinate.

Type: 
function

(inner) wktPropertiesLoad(layer)

The wktPropertiesLoad method send a query to the wkt template. The response is passed to the featureFormats.wkt_properties method.

Finally the layer.L.changed() method is called to trigger the layer.featureStyle method which assigns feature properties from the layer.featuresObject.

Parameters:
NameTypeDescription
layerlayer

A decorated format:mvt mapp layer.

(inner) wktTileUrlFunction(layer) → {function}

Returns a function that generates the tile URL to request an MVT tile with MVT geometries and ID only.

Feature properties will be requested independently.

Parameters:
NameTypeDescription
layerlayer

A decorated format:mvt mapp layer.

Returns:

A function that generates the tile URL for a given tile coordinate.

Type: 
function