如何更新kepler.gl mapstyle

时间:2018-11-13 21:20:25

标签: reactjs react-redux kepler.gl

我正在使用kepler.gl地图,并且具有自定义地图样式,试图使用addCustomMapStyleloadCustomMapStyle更新默认地图样式,但是这两种方法未更新我的配置中的地图样式

    {
  "version": "v1",
  "config": {
    "visState": {

    },
    "mapState": {
      "bearing": -14.78125,
      "dragRotate": true,
      "latitude": 50.15584222999782,
      "longitude": 8.73812510739856,
      "pitch": 55.64219672692688,
      "zoom": 6.249643007871772,
      "isSplit": false
    },
    "mapStyle": {
      "styleType": "0.ek919ez82er",
      "topLayerGroups": {},
      "visibleLayerGroups": {
        "border": false,
        "building": true,
        "label": true,
        "land": true,
        "road": true,
        "water": true
      },
      "buildingLayer": {
        "color": [
          18,
          25,
          38
        ],
        "isVisible": false,
        "opacity": 0.7
      },
      "mapStyles": {
        "0.ek919ez82er": {
          "accessToken": "accessToken",
          "custom": true,
          "icon": "BASE64IMAGE",
          "id": "0.ek919ez82er",
          "label": "Basic Template New",
          "url": "mapbox://styles/stephanefoulard/cjnvki2i00s9v2sjrbzpssze0"
        }
      }
    }
  }
}

我如何加载此自定义地图样式,它现在正在加载深色地图样式,请寻求帮助

1 个答案:

答案 0 :(得分:0)

您好,经过长时间的redux调试后,我发现addCustomMapStyleloadCustomMapStyle接受了哪些参数

this.props.dispatch(loadCustomMapStyle({ style: {},  error: false});
this.props.dispatch(addCustomMapStyle());

由于堆栈上的字符串限制,我没有发布样式,我稍后将它们发布在其他地方并更新答案