更新Mapbox工作室编辑我们通过Mapbox工作室的风格通过REST API
创建数据,地形设置和风格这是非常简单,只有一个着色层。
然后我们使用REST API添加许多图层。
例如,(参考文献参见:https://www.mapbox.com/api-documentation/#update-a-style)
的style.json文件具有通过Python脚本生成的许多新的层。
"layers": [
...
{"id": "bid_id-WPLNS", "source": "composite", "paint": {"fill-color": "rgba(62,129,54,0.4)"}, "source-layer": "Business_Improvement_Districts", "interactive": true, "filter": ["==", "bid_id", "WPLNS"], "layout": {"visibility": "visible"}, "type": "fill"},
{"id": "bid_id-WSTSH", "source": "composite", "paint": {"fill-color": "rgba(17,31,177,0.4)"}, "source-layer": "Business_Improvement_Districts", "interactive": true, "filter": ["==", "bid_id", "WSTSH"], "layout": {"visibility": "visible"}, "type": "fill"},
{"id": "bid_id-WSTSQ", "source": "composite", "paint": {"fill-color": "rgba(143,124,110,0.4)"}, "source-layer": "Business_Improvement_Districts", "interactive": true, "filter": ["==", "bid_id", "WSTSQ"], "layout": {"visibility": "visible"}, "type": "fill"},
...
那么我们发出REST HTTP补丁更新的样式:
卷曲-X PATCH “https://api.mapbox.com/styles/v1/ryozzopanodex/cistmnflb002l2woxcfbgyl3m?access_token=WRITE-TOKEN-HERE” --data @ style.json --header“内容类型:应用程序/ JSON”
对于结果:
看到https://city.tidalforce.org/bid
问题为什么当我去Mapbox工作室和编辑风格,我没有看到REST API创建的图层?
我只看到在Studio中创建的原始图层。如果我编辑并保存,看起来所有REST API创建的图层都会被覆盖。
请让我们知道,如果有编辑通过Mapbox Studio中的新图层的方式(这是我们的爱!)
就是这样,谢谢! –