我们已经知道,业务图层现在归ArcGISMap管理,因此,我们可以从它获取业务图层
这里用一个arcgis提供的WebGIS网址,上边自带了降雨量点的业务数据
http://www.arcgis.com/home/webmap/viewer.html?webmap=55c1665bcd064552944a9e8296271ec3
跟之前一样,加载地图,忘记的回看第三篇 加载地图
val url ="http://www.arcgis.com/home/webmap/viewer.html?webmap=55c1665bcd064552944a9e8296271ec3";
val arcGISMap = ArcGISMap(url)
mapView.map = arcGISMap
降雨量分布地图
可以看到,地图上已经有一个降雨量分布的图层了
获取业务图层
//获取operationalLayer 集合
val operationalLayers = mapView.map.operationalLayers
for (layer in operationalLayers) {
Log.e("test", layer.name)
}
添加本地业务图层geodatabase
var path ="数据存储位置/文件名.geodatabase"
val geodatabase = Geodatabase(path)
geodatabase.loadAsync()
geodatabase.addDoneLoadingListener {
val wellFeatureLayers = ArrayList<FeatureLayer>()
for (geoFeatureTable in geodatabase.geodatabaseFeatureTables) {
val featureLayer = FeatureLayer(geoFeatureTable)
wellFeatureLayers.add(featureLayer)
}
mapView.map.operationalLayers.addAll(wellFeatureLayers)
}
显隐控制
//这里举例控制底层
val layers = operationalLayers[0]
layer.isVisible = true //显示
layer.isVisible = false//隐藏
operationalLayers[0].isVisibleAtScale(1000.0) boolean 值,判断这个比例下是否显示
网友评论