针对图层管理LayerManager 比如之前的
-
{
-
"LayerId": "要素图层",
-
"LayerType": "MapImageLayer",
-
"ServerAddr": "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0",
-
"DefineInfo": {
-
"Opacity": 0.8,
-
"Priority": 5,
-
"SubPriority": 10,
-
"QueryFlag": true,
-
"LoadFlag": false
-
}
-
}
- 开启图层showLayer
-
import {LayerManager} from '@haibalai/react-native-arcgis';
-
LayerManager.showLayer('baseMap', "要素图层")..then((r: any) => {
-
changeErrorContent('');
-
changeContent(r);
-
})
-
.catch((error: any) => {
-
changeErrorContent(error);
-
});
- 关闭图层hideLayer
-
import {LayerManager} from '@haibalai/react-native-arcgis';
-
LayerManager.hideLayer('baseMap', "要素图层"). .then((r: any) => {
-
changeErrorContent('');
-
changeContent(r);
-
})
-
.catch((error: any) => {
-
changeErrorContent(error);
-
});
- 开启多个图层showLayers
-
import {LayerManager} from '@haibalai/react-native-arcgis';
-
LayerManager.showLayers('baseMap', ["要素图层", "要素图层1" ]);
- 关闭多个图层hideLayers
-
import {LayerManager} from '@haibalai/react-native-arcgis';
-
LayerManager.hideLayers('baseMap', ["要素图层", "要素图层1" ]);
- 设置显示隐藏
```
import {LayerManager} from '@haibalai/react-native-arcgis';
LayerManager.setVisible('baseMap', “要素图层1”, false)
.then((r: any) => {
changeErrorContent('');
changeContent('' + r);
})
更多参考 https://xiaozhuanlan.com/topic/0843961527