I am trying to get the value through ['get', 'line-dasharray'] but getting an error
Here is my code
var data = {
'type': 'FeatureCollection',
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': []
},
'properties': {
'route_id': 300,
'route_url': 'http://test.com/file.gpx',
'line-color': '#426d7e',
'line-width': 3,
'line-opacity': 1,
'line-dasharray': [5, 2]
},
},
]
}
// some code
map.addSource('locations-rote', {
type: 'geojson',
data: data,
generateId: true
});
map.addLayer({
'id': 'route-coordinates',
'type': 'line',
'source': 'locations-rote',
'layout': {
'line-join': 'round',
'line-cap': 'round'
},
'paint': {
'line-color': ['get', 'line-color'],
'line-width': ['get', 'line-width'],
'line-opacity': ['get', 'line-opacity'],
'line-dasharray': ['get', 'line-dasharray']
}
});
I try to use an array expression - https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/#types-array but also get an error. Tell me how to solve the problem.