新手需要帮助,使用Mapbox GL JS在地图上绘制多点数据

问题描述

“很抱歉,但是我似乎无法弄清楚为什么下面的addLayer函数调用会导致错误消息“ layers.points:未找到源”人口””。我究竟做错了什么?我只是想在地图上将几个点绘制成圆形。

var map = new mapBoxgl.Map({
    container: 'map',style: 'mapBox://styles/mapBox/outdoors-v11',// stylesheet location
    center: [-93,31],// starting position [lng,lat]
    zoom: 6 // starting zoom
}) ;

var nav = new mapBoxgl.NavigationControl() ;
map.addControl(nav,'bottom-right') ;

map.on('load',function() {

    map.addSource('poulation',{
        'type': 'geojson','data': {
            'type': 'MultiPoint','coordinates': [
                [-84.2963900,33.7747200],[-85.1116700,31.2925000],[-82.3791700,34.1780600],[-82.4666700,34.2333300],[-85.2505600,31.5716700],[-83.3069400,31.9919400],[-85.1507806,30.3934889],[-99.7327800,32.4486100],[-93.6438900,31.6313900]
            ]
        }
    });

    map.addLayer({
        'id': 'points','type': 'circle','source': 'population','paint': {
            'circle-radius': 10,'circle-color': '#007cbf'
        }
    });

}) ;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)