最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Mapbox GL js available icons - Stack Overflow

programmeradmin5浏览0评论

I am rewriting a web application from Mapbox.js to Mapbox GL js. Using the standard 'mapbox://styles/mapbox/streets-v8' style, where can I find a list of all working marker icons?

Here is my code:

m.map.addSource("markers", {
        "type": "geojson",
        "data": {
            "type": "FeatureCollection",
            "features": {
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": ["-75.532965", "35.248018"]
                },
                "properties": {
                    "title": "Start",
                    "marker-symbol": "entrance",
                    "marker-size": "small",
                    "marker-color": "#D90008"
                }
            }
        }
    });
    m.map.addLayer({
        "id": "markers",
        "type": "symbol",
        "source": "markers",
        "layout": {
            "icon-image": "{marker-symbol}-15", //but monument-15 works
            "text-field": "{title}",
            "text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
            "text-offset": [0, -1.6],
            "text-anchor": "top"
        }
    });

I read that all Maki icons should be made available for styles that don't have icons as a default: But most of them don't work. Also there is the problem with the sizes - for Maki they were -small, -medium and -large, and now I see -11 and -15.

I just need to use some basic marker icons.

I am rewriting a web application from Mapbox.js to Mapbox GL js. Using the standard 'mapbox://styles/mapbox/streets-v8' style, where can I find a list of all working marker icons?

Here is my code:

m.map.addSource("markers", {
        "type": "geojson",
        "data": {
            "type": "FeatureCollection",
            "features": {
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": ["-75.532965", "35.248018"]
                },
                "properties": {
                    "title": "Start",
                    "marker-symbol": "entrance",
                    "marker-size": "small",
                    "marker-color": "#D90008"
                }
            }
        }
    });
    m.map.addLayer({
        "id": "markers",
        "type": "symbol",
        "source": "markers",
        "layout": {
            "icon-image": "{marker-symbol}-15", //but monument-15 works
            "text-field": "{title}",
            "text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
            "text-offset": [0, -1.6],
            "text-anchor": "top"
        }
    });

I read that all Maki icons should be made available for styles that don't have icons as a default: https://github.com/mapbox/mapbox-gl-styles/issues/241 But most of them don't work. Also there is the problem with the sizes - for Maki they were -small, -medium and -large, and now I see -11 and -15.

I just need to use some basic marker icons.

Share Improve this question asked Mar 21, 2016 at 12:39 the_webthe_web 4061 gold badge4 silver badges11 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 16

We're still sorting out the final implementation details for the default icon set and will document that set thoroughly once it has been decided upon.

Until then, you can see exactly what icons are available for a given style by peeking at the mapbox-gl-styles repo in the sprites folder.

Since that issue was closed, all maki icons are now natively available in mapbox-gl.js. You can see all available at https://www.mapbox.com/maki-icons/. You can also multiply their size using the icon-size paint property, though this may result in pixelation. There are still some hitches, like the icon-color property not yet working, so you'll need to edit, recolor, and republish icons for now. (issue #3605).

发布评论

评论列表(0)

  1. 暂无评论