React Map GL:如何查看默认情况下可以使用的图标mapbox-Map sprite?
我有以下几点,它们将成为地图上的公共汽车:React Map GL:如何查看默认情况下可以使用的图标mapbox-Map sprite?,mapbox,sprite,mapbox-gl-js,react-map-gl,Mapbox,Sprite,Mapbox Gl Js,React Map Gl,我有以下几点,它们将成为地图上的公共汽车: const features = buses.map((el) => ({ type: 'Feature', geometry: { type: 'Point', coordinates: el.state.position.coordinates.map((coordinate) => +coordinate), }, properties: { reg_number
const features = buses.map((el) => ({
type: 'Feature',
geometry: {
type: 'Point',
coordinates: el.state.position.coordinates.map((coordinate) => +coordinate),
},
properties: {
reg_number: el.reg_number,
object_id: el.object_id,
route: el.route,
fuel: +el.state.fuel,
speed: +el.state.speed,
},
}));
return features;
}
它的图层如下所示:
id: 'Point-data',
type: 'circle',
paint: {
'circle-color': {
property: 'percentile',
stops: [
[10, "#ff0000"],
[20, '#ff3300'],
[30, "#ff6600"],
[40, "#ff9100"],
[50, '#ffd000'],
[60, '#bbff00'],
[70, '#b3ff00'],
[80, '#91ff00'],
[90, '#7bff00'],
[100, '#1eff00']
],
},
'circle-radius': 7,
},
};
我想使用“符号”类型并设置图标,而不是“圆圈”。据我所知,它需要一个来自地图样式精灵图标集合的名称。我现在不需要做一个定制的精灵,我想我会对默认的总线图标感到满意,它在精灵中肯定有一个黑色的地图框,但我不知道如何找到它。在哪里可以看到精灵图标列表及其名称?以及它所包含的png和json文件 对于其他人,我想分享我自己找到的解决方案: 我在中创建了一个地图,然后按照文档进行操作: 特别是:
curl "https://api.mapbox.com/styles/v1/{username}/{style_id(take it from the url of the map u created)}/sprite.{format(png or json)}?access_token=pk.eyJ1IjoiYXJ0dm9sY2hhcmEiLCJhIjoiY2s3bHJ2NjU4MGFjbDNtczJnam10aDU1aSJ9.oH_RWYjKfrKGC77m
在那里我找到了巴士图标。我制作了一个符号层,我把图标的名字放在“图标图像”中。我希望这将有助于中小企业