Display a vector tile layer in Openlayers with layer from arcgis REST map server

161 views Asked by At

I work with a quite big feature layer that is hosted in a arcgis map server. Because of its size, loading it in Openlayers as a VectorLayer is too slow (there is about 50mb of data to load, which can take up to 10 seconds to do so). I wish to switch to vector tile layer source, which would enable to load only the data needed, depending on the zoom level. I tried using the same approach the arcgis doc says to do for vector tile server, but it doesnt work, and gives me the following error:

index.js:207 Uncaught Error: Unimplemented type: 4 at Pbf.skip (index.js:207:1)

It would actually make sense if it doesnt work, but at the same time, the same layer is used in a argis online app . And the layer is loaded a lot faster, using tiles. Here is a snippet of the network tab zooming in: enter image description here So, do you know a way to optimize this type of service in Openlayers, somewhat like it is done in arcgis online?

1

There are 1 answers

3
Mike On BEST ANSWER

The ArcGIS PBF data is not compatible with MVT, you need a parser https://github.com/rowanwins/arcgis-pbf-parser for the client to convert to it a GeoJSON format which OpenLayers can understand.

Working example https://codesandbox.io/s/vector-esri-forked-h9jz7q?file=/main.js

Example without tiling https://codesandbox.io/s/vector-esri-forked-3m33jm?file=/main.js