Select to view content in your preferred language

Is it possible to render mapbox vector tiles (pbf) from a custom tile-server

5683
12
10-10-2016 10:42 PM
EivindRønnevik
Deactivated User

Hi,

I have been testing the VectorTileLayer, both in 3.18 and 4.1 version. However it seems that the implementation of these layers (or the vectorTileLayerLoader.js to be more explicit) constrains the use of the VectorTileLayer to either
a) A Mapbox service - providing the ACCESS_TOKEN
b) An ESRI vector tile service, either using the URL directly or the URL to a Style json


I have made a local/custom tileserver using node.js and some of the javascript libraries from mapbox, and I would like to know if there is a way to render the vector tiles coming from this local server?


A URL like "http:\\somehost\layerName\{level}\{col}\{row}.mvt" (similar to the concept of WebTiledLayer) is what I'm after, but this is not supported by the current implementation I believe (at least I have not found a way to get it working).


I have also tried to extend the VectorTileLayer object and override the getTileUrl method, but this has not worked either.

getTileUrl: function(level, row, col) {
              return url+level+"/"+col+"/"+row+".mvt";
}

Does anyone know if it is possible to get this to work?


Kind regards,
Eivind

Tags (1)
12 Replies
StephenSontag55
Emerging Contributor

That's the weird thing.  The sprite json and png never gets called.  I tried numerous versions but even with this, the files don't get called. Again it works for type = circle.

"sprite": "https://cdn.arcgis.com/sharing/rest/content/items/30d6b8271e1849cd9c3042060001f425/resources/sprites...",
"glyphs": "https://basemaps-api.arcgis.com/arcgis/rest/services/OpenStreetMap_v2/VectorTileServer/resources/fon...",

source: 'layerid',
'source-layer': 'layerid',
type:'symbol',
layout: {
"icon-image": "Road/Shield white black/6",
'symbol-placement': 'point',
'text-font': ['Arial Regular'],
};
spaint: {
color: style.color,
};

0 Kudos
RogerAustin
Emerging Contributor

That json looks weird. You have a mixture of single quotes, double quotes and no quotes at all, and a property called spaint. Perhaps get all that fixed up.

But I think your issue is that the "sprite" property should be the path to the sprite file itself, minus the extension, not a folder path. See https://docs.mapbox.com/mapbox-gl-js/style-spec/sprite/#loading-sprite-files 

0 Kudos
StephenSontag55
Emerging Contributor

Thanks for the reply.  I'll clean up the json and try again, but i was trying to figure out why the sprint file never gets called.  I could call it "NOTAFILE" and it still won't try to load it.  Other ESRI vector tiles layers, the sprite.json and sprite.png get's called when layer is added to map.

The layer is added to the map because I see the tiles being called with data in the MVT.

0 Kudos