[OpenLayers-Users] VectorTileService

David Haynes haynesd2 at gmail.com
Wed Feb 10 10:46:23 PST 2021


Hello,

I'm looking for some good examples of using VectorTiles from Geoserver with
an openlayer webmap. I'm just having a bit of difficulty understanding the
Openlayer calls necessary. In particular, the {z} {x} {y} is throwing us
off. The documentation around the openlayers method
"ol.tilegrid.createXYZ"  has left me with lots of questions. I'm not sure
what is returned from this method.

There seem to be a few ways that you can construct these and I'm interested
in the tradeoffs.

const layer = new ol.layer.VectorTile({
    style: vectorStyle,
    //declutter: true,
    source: new ol.source.VectorTile({
        tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}),
        format: new ol.format.MVT(),
        url: `https://<geoserver_host>/gwc/service/tms/1.0.0/${layer_name}@${matrix_set}@pbf/{z}/{x}/{-y}.pbf`,
    }),
});



ew VectorTileLayer({
      source: new VectorTileSource({
        attributions:
          '© OpenStreetMap contributors, Who’s On First, ' +
          'Natural Earth, and openstreetmapdata.com',
        format: new TopoJSON({
          layerName: 'layer',
          layers: ['water', 'roads', 'buildings'],
        }),
        maxZoom: 19,
        url:
          'https://tile.nextzen.org/tilezen/vector/v1/all/{z}/{x}/{y}.topojson?api_key='
+
          key,
      })


 Does openlayers have a community forum like Geoserver?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20210210/e6fcf341/attachment.html>


More information about the Users mailing list