这就是我的数据集的样子:
我想要做的是根据频率列改变挤压高度。我可以成功地显示这些点,但每当我使用填充挤压时,我都在挣扎。你能帮我指出正确的方向吗?
map.addLayer({
'id': 'total',
'type': 'circle',
'source': {
type: 'vector',
url: 'mapbox://askakdagr8.9tklrr8g'
},
'source-layer': 'GroupedOutput-9i6ink',
'paint': {
// make circles larger as the user zooms from z12 to z22
'circle-radius': {
'base': 1.75,
'stops': [
[12, 2],
[22, 180]
]
},
'circle-color': '#ff7770'
}
});发布于 2018-05-29 06:28:19
由于mapbox-gl-js目前没有挤压圆的功能,所以需要用多边形替换点,然后用函数turf.circle插值圆。
map.on('sourcedata', function(e) {
if (e.sourceId !== 'total') return
if (e.isSourceLoaded !== true) return
var data = {
"type": "FeatureCollection",
"features": []
}
e.source.data.features.forEach(function(f) {
var object = turf.centerOfMass(f)
var center = object.geometry.coordinates
var radius = 10;
var options = {
steps: 16,
units: 'meters',
properties: object.properties
};
data.features.push(turf.circle(center, radius, options))
})
map.getSource('extrusion').setData(data);
})[ http://jsfiddle.net/zjLek40n/ ]
https://stackoverflow.com/questions/50570639
复制相似问题