【问题标题】:How to change a marker base in mapbox gl?如何更改 mapbox gl 中的标记库?
【发布时间】:2016-11-08 05:18:33
【问题描述】:

当我在我的 mapbox gl 脚本中添加一个标记时,它的定位方式是它的中心指示位置,而不是基地。结果,标记似乎指示了不正确的位置。 Please see the screenshot

有没有办法改变图像中用作坐标基础的部分?

提前致谢! 奥克塔维亚

【问题讨论】:

    标签: mapbox geojson marker mapbox-gl


    【解决方案1】:

    使用icon-offset layout property 将图标从您的坐标偏移

    map.addLayer({
        "id": "pointclick",
        type: 'symbol',
        source: 'pointclick',
        "layout": {
            "icon-image": "{marker-symbol}",
            "icon-size":1,
            "icon-offset": [0, -13]
        },
        "paint": {}
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-26
      • 1970-01-01
      • 2020-06-08
      • 2016-12-10
      • 1970-01-01
      • 1970-01-01
      • 2016-02-23
      相关资源
      最近更新 更多