You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dynamic vector layers represents a special type of vector analytics where the MVT data is generated on the fly through a PostgreSQL function. This makes it possible to create simulation by adjusting/changing specific input parameters.
The whole concept of dynamic vector layers of function layers in MVT servers is to generate the data on the fly and this is very expensive, mainly because of simplification and other aspects defined through postgis MVT functions.
An alternative idea is to generate static MVT as a materialized view in postgis and then retried the MVT encoded tile data through a subquery. Next, a PLV8 Javascript or python fucntion could be used to to decode, update and encode back the tile data.
-- Create the materialized view with MVT data for the entire layer
CREATE MATERIALIZED VIEW mvt_layer_view ASSELECT
ST_AsMVTGeom(geom, ST_TileEnvelope(0, 0, 0), 4096, 256, true) AS geom,
attribute1, attribute2, ... -- Add other attributes as neededFROM
your_layer_table;
-- Create the SQL function to retrieve tile data using XYZ coordinatesCREATE OR REPLACEFUNCTIONget_tile_data(x integer, y integer, z integer)
RETURNS byteaAS $$
DECLARE
tile_data bytea;
BEGIN-- Retrieve tile data from the materialized view into a variableSELECT mvt_data INTO tile_data
FROM mvt_layer_view
WHERE x = $1AND y = $2AND z = $3;
-- Call the PL/v8 function to add a property to the tile data
tile_data := add_property_to_tile(tile_data, 'new_property', 'new_value');
-- Return the modified tile data
RETURN tile_data;
END;
$$ LANGUAGE plpgsql;
This approach will probably work well form higher zoom levels where tiles will have fewer features.
And alternative implementatino is to create a nodejs or fastAPI MVT enpoint wich will read binary tile data from a static MVT, decode it, compute dynamically various other props and append the props back to the tile.
Most probably this endpoint will also connect topostgres to fetch data for the enw props from various tables.
Essentially this would be an alterbnative to MVT function layer
Feature Description
The dynamic vector layers represents a special type of vector analytics where the MVT data is generated on the fly through a PostgreSQL function. This makes it possible to create simulation by adjusting/changing specific input parameters.
The whole concept of dynamic vector layers of function layers in MVT servers is to generate the data on the fly and this is very expensive, mainly because of simplification and other aspects defined through postgis MVT functions.
An alternative idea is to generate static MVT as a materialized view in postgis and then retried the MVT encoded tile data through a subquery. Next, a PLV8 Javascript or python fucntion could be used to to decode, update and encode back the tile data.
This approach will probably work well form higher zoom levels where tiles will have fewer features.
And alternative implementatino is to create a nodejs or fastAPI MVT enpoint wich will read binary tile data from a static MVT, decode it, compute dynamically various other props and append the props back to the tile.
Most probably this endpoint will also connect topostgres to fetch data for the enw props from various tables.
Essentially this would be an alterbnative to MVT function layer
Feature Implementation
No response
Feature Alternatives
No response
Feature Impact
No response
Feature Rationale
No response
Feature Considerations
No response
Feature Requirements
No response
┆Issue is synchronized with this Wrike task by Unito
The text was updated successfully, but these errors were encountered: