2

recently I have installed the Geoserver with vector tile layer extension, getting the data in pbf (Mapbox vector tile format) with this URL AND I think there is gzip problem too with this.

http://localhost:8080/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=VectorTileLayer:tbl__analysis&STYLE=&TILEMATRIX=EPSG:4326:{z}&TILEMATRIXSET=EPSG:4326&FORMAT=application/json;type=geojson&TILECOL={x}&TILEROW={y}

I want to convert my this request URL to RESTfull like this.

http://localhost:8080/geoserver/gwc/service/wmts/1.0.0/blocks/{z}/{x}/{-y}.pbf

I have tried many methods but none of them working

My goal is to get the data in RESTful link for vector tiles .pbf layer

Update..

Logical reply in the question.

Geoserver currently doesn't support any restful service for URL mapping.

  • 2
    Documentation in geowebcache.org/docs/current/services/wmts.html says "GeoWebCache fully implements WMTS using KVP, and is seeking funding for the RESTful and SOAP based approaches." The approach would be to implement RESTful access by your own coding or by funding it. – user30184 Feb 20 '18 at 15:13
  • 1
    i want to use wmts layer in mapbox gl library i don't know what approach should i follow to publish vector tile layer – Muhammad Imran Siddique Feb 20 '18 at 15:16
  • 1
    If GeoServer WMTS does not work with REST requests and MapBox GL can't make KVP requests then you have a problem. Perhaps using TMS instead of WMTS could be a solution docs.geoserver.org/latest/en/user/extensions/vectortiles/…. – user30184 Feb 20 '18 at 15:31
  • URL templating has nothing to do with REST. For REST you need hypermedia formats, the client has no knowledge of the API, only the hypermedia. – nmtoken Feb 21 '18 at 6:25
3

To use mapbox vector tiles served by GeoServer, you can do it like this:

// First the layer URL pattern
var layerWMTS = 'http://localhost:8080/geoserver/gwc/service/wmts?layer=public:list_parcels_hobart_4326&tilematrixset=EPSG:900913&Service=WMTS&Request=GetTile&Version=1.0.0&Format=application/x-protobuf;type=mapbox-vector&TileMatrix=EPSG:900913:{z}&TileCol={x}&TileRow={y}'

// Now add the layer
map.addLayer({
  'id': 'geoserver',
  'type': 'fill',
  'source': {
    'type': 'vector',
    'tiles': [
      layerWMTS
    ]
  },
  'layout': {
    'visibility': 'visible'
  },
  'source-layer': 'list_parcels_hobart_4326',
  'paint': {
    'fill-color': 'rgba(244, 131, 66, 0.4)',
    'fill-outline-color': 'rgba(244, 131, 66, 0.9)'
  }
})

This is about as simple as it gets. Note that some of the keywords need to be changed, soch as the layer=public:list_parcels_hobart_4326 section of the layer URL, and the 'source-layer': 'list_parcels_hobart_4326' of the layer parameter object. These can be taken from what you have configured in GeoServer.

And just a note to say that I think that GeoServer's vector tiles are pretty good, but it doesn't seem configurable, so you can't change simplification and such. I have a bit of exploration over here, although it's probably not well documented and a bit messy!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.