【发布时间】:2019-11-29 16:27:33
【问题描述】:
我对 mapboxgl 非常陌生,并试图创建一个允许用户随时间过滤点的地图。我用我的数据定制了本教程,以启动并运行初始地图:
https://docs.mapbox.com/help/tutorials/show-changes-over-time/
在我加载数据并意识到许多点共享相同的坐标之前,一切都运行良好。
一些谷歌搜索揭示了这个答案:
Multiple markers - Same coordinates
使用偏移或爬取的想法都是合理的解决方案。不幸的是,我不清楚在加载数据时如何将这些应用于数据。我认为脚本的相关部分是:
map.on('load', function() {
map.addLayer({
id: 'year',
type: 'circle',
source: {
type: 'geojson',
data: './grandpascan.geojson' // replace this with the url of your own geojson
},
paint: {
'circle-radius': [
'interpolate',
['linear'],
['number', ['get', 'Pages']],
0, 4,
5, 24
],
'circle-color': [
'interpolate',
['linear'],
['number', ['get', 'Pages']],
0, '#2DC4B2',
1, '#3BB3C3',
2, '#669EC4',
3, '#8B88B6',
4, '#A2719B',
5, '#AA5E79'
],
'circle-opacity': 0.8
},
如果这是正确的,我如何确定这些样式的要点?它们似乎不是可以在 CSS 中轻松解决的标记,尽管我可能完全误解了这一切是如何组合在一起的。
谢谢!
【问题讨论】:
标签: mapbox mapbox-gl-js mapbox-gl mapbox-marker