mapbox gl-js:如何从 mapbox studio 获取 points/polygons 的样式并以编程方式定位它?
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。
我已经通过使用 getPaintProperty and setPaintProperty 实现了上述目标,您可以从隐藏层使用
之类的东西获得 属性
mapInstance.getPaintProperty("hidden layer name", "fill-color");
并设置为
setPaintProperty("visible layer id", "fill-color", valueFromTheGetMethod);
只适合一个人属性,所以你需要'manually'收集你需要的一切。
我有一张包含大量动态生成数据的地图。
我希望将此数据的样式保留在 mapbox studio 本身中 - 但想手动(以编程方式)定位它。
我发现的最好的例子是:https://www.mapbox.com/mapbox-gl-js/example/data-driven-circle-colors/ 然而定位也源于 mapbox studio。
我已经通过使用 getPaintProperty and setPaintProperty 实现了上述目标,您可以从隐藏层使用
之类的东西获得 属性mapInstance.getPaintProperty("hidden layer name", "fill-color");
并设置为
setPaintProperty("visible layer id", "fill-color", valueFromTheGetMethod);
只适合一个人属性,所以你需要'manually'收集你需要的一切。