With OpenLayers, I'm creating layers like ol.layer.VectorTile
var projection_epsg_name = 'EPSG:900913';
var geoserverLayerName = 'teste:map_shape2';
const tileLoadURL= 'http://127.0.0.1:8081/geoserver/gwc/service/tms/1.0.0/' + geoserverLayerName + '@' + projection_epsg_name + '@pbf/{z}/{x}/{-y}.pbf';
// const tileLoadURL = "http://127.0.0.1:8081/geoserver/gwc/demo/teste:map_shape2?gridSet=EPSG:900913&format=application/vnd.mapbox-vector-tile"
// const tileLoadURL = "http://localhost:8081/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=" + geoserverLayerName + "&STYLE=&TILEMATRIX=" + projection_epsg_name + ":{z}&TILEMATRIXSET=" + projection_epsg_name + "&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
var vectorSource = new ol.source.VectorTile({
tilePixelRatio: 1,
tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}),
format: new ol.format.MVT(),
url: tileLoadURL,
});
var vectorTile = new ol.layer.VectorTile({
style:styleFunction,
source:vectorSource,
})
map.addLayer(vectorTile);
I need id
to perform a query in the database, but I do not have this attribute. My data comes from PostGIS, and GeoServer is configured in such a way that it displays the id
. How can I have this attribute using OpenLayers?