我下面有一个回调函数,该函数能够从Eventbrite API生成数据。目前,此功能可以通过“新标记”方法在我的Mapbox地图上生成标记。但是,我想通过“ Mapbox addLayer”方法将这些数据生成到地图上的图层中,而不是使用标记。 callbackEventbrite(function(result){ const keys = Object.values(result); for(const key of keys){ geojson = { type: 'featureCollection', features: [{ type: 'feature', geometry: { type: 'Point', coordinates: [key.venue.longitude, key.venue.latitude] } }] } eventInfo.push( {"longitude": key.venue.longitude , "latitude": key.venue.latitude , "name": key.name.text, "venue": key.venue.name, "date": key.start.local, "category": key.category_id} ); }});我基本上想要这个,它根据几何的坐标在地图上生成符号,但是使用API数据。map.addLayer({ "id": "locations", "type": "symbol", "source": { "type": "geojson", "data": { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "Title": "The Congress Inn", "Description": "Pub located in Longton", "Type": "Pub", "Address": "14 Sutherland Rd, Stoke-on-Trent ST3 1HJ", "Longitude": 2.1316, "Latitude": 52.9878, "icon": "bar" }, "geometry": { "coordinates": [ -2.131836, 52.987238 ], "type": "Point" } },任何帮助深表感谢!谢谢你
添加回答
举报
0/150
提交
取消