Mapbox在圆上添加背景图片

时间:2018-09-13 13:27:00

标签: javascript mapbox

我正在使用mapbox,并且已经对数据进行了聚类。现在我想展示一个 用户放大到某个点时的背景图像(而不是黑色背景!)。

我这样添加它:

this.map.addLayer({
    id: "unclustered-point",
    type: "circle",
    source: "earthquakes",
    filter: ["!has", "point_count"],
    paint: {
        "circle-color": "black",
        "circle-radius": 8,
        "circle-stroke-width": 4,
        "circle-stroke-color": "#fff",
    }
});

enter image description here

我正在像这样加载我的geojson:

this.map.addSource("earthquakes", {
    type: "geojson",
    data: this.locations,
    cluster: true,
    clusterMaxZoom: 14, // Max zoom to cluster points on
    clusterRadius: 50 // Radius of each cluster when clustering points (defaults to 50)
});

this.map.addLayer({
    id: "clusters",
    type: "circle",
    source: "earthquakes",
    filter: ["has", "point_count"],
    paint: {
        "circle-color": [
            "step",
            ["get", "point_count"],
            "#002e5b",
            100,
            "#002e5b",
            750,
            "#002e5b"
        ],
        "circle-radius": [
            "step",
            ["get", "point_count"],
            20,
            100,
            30,
            750,
            40
        ],
    }
});

那么如何获得背景图像而不是黑色背景?

0 个答案:

没有答案