簡體   English   中英

mapbox gl-js:如何從mapbox studio中獲取點/多邊形的樣式並以編程方式進行定位?

[英]mapbox gl-js: how to get the styles of points/polygons from mapbox studio and position it programmatically?

我有一張地圖,其中包含大量動態生成的數據。

我希望將這些數據的樣式保留在mapbox Studio本身中-但想手動(以編程方式)放置它。

我發現的最好的示例是: https ://www.mapbox.com/mapbox-gl-js/example/data-driven-circle-colors/但是其定位也源於mapbox studio。

我已經設法通過使用getPaintPropertysetPaintProperty來實現上述目標 ,在其中您可以從隱藏層獲取具有類似以下內容的屬性

mapInstance.getPaintProperty("hidden layer name", "fill-color");

並設置為

setPaintProperty("visible layer id", "fill-color", valueFromTheGetMethod);

它僅對單個屬性有用,因此您需要“手動”收集所需的一切。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM