// 去除logo 水印
val licenseCode = "runtimelite,1000,rud4449636536,none,NKMFA0PL4S0DRJE15166"
ArcGISRuntimeEnvironment.setLicense(licenseCode)
sceneView.isAttributionTextVisible = false
val scene = ArcGISScene()
// 设置加载天地图---影像
val webTiledLayer =
TianDiTuMethodsClass.CreateTianDiTuTiledLayer(TianDiTuMethodsClass.LayerType.TIANDITU_IMAGE_MERCATOR)
// 矢量:TianDiTuMethodsClass.LayerType.TIANDITU_VECTOR_MERCATOR
val webTiledLayer1 =
TianDiTuMethodsClass.CreateTianDiTuTiledLayer(TianDiTuMethodsClass.LayerType.TIANDITU_IMAGE_ANNOTATION_CHINESE_MERCATOR)
// 矢量:TianDiTuMethodsClass.LayerType.TIANDITU_VECTOR_ANNOTATION_CHINESE_MERCATOR
val requestConfiguration = RequestConfiguration().apply {
headers["referer"] = "http://www.arcgis.com"
}
webTiledLayer.requestConfiguration = requestConfiguration
webTiledLayer1.requestConfiguration = requestConfiguration
webTiledLayer.loadAsync()
webTiledLayer1.loadAsync()
val basemap = Basemap(webTiledLayer)
basemap.baseLayers.add(webTiledLayer1)
scene.basemap = basemap
// 加载自己的地图
val arcGISMapImageLayer =
ArcGISMapImageLayer("http://......./MapServer")
arcGISMapImageLayer.loadAsync()
scene.operationalLayers.add(arcGISMapImageLayer)
sceneView.scene = scene
// 控制地图视角
// 前两个是经纬度,后几个是角度
val camera = Camera(36.53481, 115.47989, 2000.0, 345.0, 0.0, 0.0)
sceneView.setViewpointCamera(camera)
/**
* 设置底图点击事件
*/
sceneView.setOnTouchListener(object : DefaultSceneViewOnTouchListener(sceneView){
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
e ?:return false
val mapPoint = android.graphics.Point(e.x.toInt(), e.y.toInt())
val listListenableFuture = sceneView.identifyGraphicsOverlaysAsync(mapPoint,
12.0,false,5)
listListenableFuture.addDoneListener{
try {
val results = listListenableFuture.get()
for (result in results) {
for (graphic in result.graphics) {
val stationCode = graphic.attributes["name"].toString()
ToastUtils.showToast(this@TestActivity,"$stationCode")
}
}
} catch (e: Exception) {
}
}
return super.onSingleTapConfirmed(e)
}
})
2023-02-10 ArcGIS三维加载天地图底图
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 1.首先查看是否添加天地图的key,最近天地图官方频繁更新服务,需保证有key且申请的key为Android端的k...
- 1. 地图显示流程图 基本的实现思路是:1.准备数据;2.map逐个加载数据,通过控制图层可见性进行跳转显示;3....