Select to view content in your preferred language

Interpolation doesn't seem to work in VectorTileLayer style

53
0
Friday
cdbj
by
New Contributor

When using a VectorTileLayer to display a line that should scale its width with the zoom, the interpolation expression does not seem to work. This code does work in Mapbox studio, but in ArcGIS JS 4.30.9 the line simply stays at 1 pixel width regardless of zoom level. See the images attached at multiple zoom levels, but the line width is the same.

Is this a bug, or am I doing something wrong?

MVT style spec: https://docs.mapbox.com/style-spec/reference/expressions/#interpolate

I can't find a suitable public vector tile source to demo this, but here's the code I'm seeing an issue with:

new VectorTileLayer({
id: "test",
title: "test",
style: {
version: 8,
sources: {
routes: {
type: "vector",
tiles: [
`url/tiles/vector/routes/{z}/{x}/{y}.pbf`,
],
},
},
layers: [
{
id: "routes-line",
type: "line",
source: "routes",
"source-layer": "routes",
paint: {
"line-cap": "round",
"line-join": "none",
"line-color": "rgba(128, 128, 128, 0.5)",
"line-width": [
"interpolate",
["exponential", 1.71],
["zoom"],
12,
1,
18,
15,
],
},
},
],
},
});
0 Kudos
0 Replies