/layer/formats/mvt

The module exports the "mvt" format method for the Mapp layer decorator method.

Requires

Methods

(inner) MVT(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.

(inner) reload()

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

The MVT tiles of a wkt_properties layer hold feature geometries and ID only. The tile source is not affected by a change of the layer filter, style, or params. Clearing the tile source would render the layer blank before the wktPropertiesLoad method has returned the feature properties for the current layer filter. The layer is instead rendered from the wktPropertiesLoad method which will clear and refresh the tile sources itself for a feature which has not been rendered before, eg. after a location geometry has been created.

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

(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

(async, inner) wktPropertiesLoad(layer, reloadopt)

The wktPropertiesLoad method is triggered from the layer.changeEndCallbacks methods array when the mapview view is changed. The method is also triggered from the reload method which is called when the layer display is toggled on.

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.

The tile sources are cleared and refreshed if the method has been called from the layer.reload method and the response holds a feature which has not been rendered before, eg. after a location geometry has been created. The tile geometries are otherwise requested by the tile source itself for the current mapview.

Parameters:
NameTypeAttributesDescription
layerlayer

A decorated format:mvt mapp layer.

reloadboolean<optional>

The method has been called from the layer.reload method.

Properties
NameTypeAttributesDescription
layer.wkt_propertiesboolean<optional>

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

(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