SUMMARY: I need to color code lines based on information not attached to the dataset in the style. How do I do this? Below is a suggested path, but apparently it may be the wrong direction to solve my problem.
DETALS: I'd like to color-code a layer in the map with data that is not already attached to the source; it is coming from somewhere else.
I'd like to use similar code below to dynamically add a new 'property', i.e. newPopulation, that does not already exist in the source, i.e. populationSource.
How do I add a new property and values to a source, i.e. populationSource.
map.addLayer({
'id': 'state-population',
'source': 'populationSource',
'source-layer': 'state_county_population_2014_cen',
'maxzoom': zoomThreshold,
'type': 'fill',
'filter': ['==', 'isState', true],
'paint': {
'fill-color': {
property: 'newPopulation',
stops: [
[0, '#F2F12D'],
[500000, '#EED322'],
[750000, '#E6B71E'],
[1000000, '#DA9C20'],
[2500000, '#CA8323'],
[5000000, '#B86B25'],
[7500000, '#A25626'],
[10000000, '#8B4225'],
[25000000, '#723122']
]
},
'fill-opacity': 0.75
}
}, 'waterway-label');