Product expression causes features to not render

2019-08-20 21:04发布

问题:

I have a map with linear features that have an offset in the style:

"line-offset": {
  "stops": [ [ 12, 0 ], [ 16, 2 ] ]
},

If I try to substitute the value 2 with a product expression, the features fail to render.

"line-offset": {
  "stops": [ [ 12, 0 ], [ 16, ["*", 2, 1] ] ]
},

There is no error in the javascript console.

I am using the latest version, v0.49.0.

Am I using the expression correctly?

回答1:

To use expressions, you would need to change the syntax:

"line-offset": [
  "interpolate",
  [ "linear" ],
  [ "zoom" ],
  12, 0,
  16, ["*", 2, 1],
]