3

I am trying to display vector tile layers from GeoServer in ArcGIS using JavaScript API. I have referred this.here they have used tegola service but i want to add "application/x-protobuf;type=mapbox-vector" which is published in GeoServer.

In OpenLayers I am able to display using Mapbox vector tiles service is "http://localhost:8080/geoserver/gwc/service/tms/1.0.0/Cadastral:CADASTRAL@EPSG:900913@pbf/{z}/{x}/{y}.pbf"

Same thing I want to add in ArcGIS. How to add it in ArcGIS using JavaScript API?

1
  • I am facing the same problem currently. I tried to use wmts url which is not working as ESRI will not replace x/y/z accordingly. Using tms is not working either as the y paramater is not set correct. I also tried using EPSG:3857 / EPSG:900913 and also defining the AGOL:3857 Gridset. Nothing works. It looks like ESRI is ignoring the "scheme": "tms" option in the source. Did anyone manage to display Geoserver Vector Sources in ESRI JS 4.x? Commented Jan 4, 2023 at 16:18

1 Answer 1

1

The solution I found is using a GridSet in Google Mercator that has 512x512 tiles like EPSG:900913x2 and flipping the Y axis using flipY=true. I am not sure if it really always needs to be 512x512 tiles in size, but ESRI at least requires it for Pro and it's also working in JS.

My final settings look like:

const vecSettings = {
    style: {
      "version": 8,
      "sources": {
        "sample": {
          "type": "vector",
          "scheme": "tms",
          "tiles": [
            `http://localhost:8080/geoserver/sample/gwc/service/tms/1.0.0/sample:sample@EPSG:900913x2@pbf/{z}/{x}/{y}.pbf?token=${jwt}&flipY=true`
          ],
          "minZoom": 0,
          "maxZoom": 19
        }
      },
      "layers": [
        {
          id: 'sample',
          type: "circle",
          source: "sample",
          "source-layer": "sample",
          layout: {},
          paint: {
            "circle-color": "#31d8f9",
            "circle-stroke-color": "#000000",
            "circle-stroke-width": 2
          }
        }
      ]
    }
};
const layer = new VectorTileLayer(vecSettings);

If you are using the AuthKey plugin the token paramater can also be set in the tiles URL. Also the Geofence plugin is working in combination with GWC and Vector Tiles and all rules are applied accordingly.

3
  • can you access the attributes? like the different columns etc
    – ziggy
    Commented Jun 8, 2023 at 16:09
  • This helped us massively thank you. Commented Apr 18 at 11:33
  • Question - is the config flipY=true something that applies to all MB tile requests or does this just work with Geoserver Commented Apr 18 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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