ArcGIS 加载3D地图和3D建筑

1、导入框架(可以在官网上找最新框架)

implementation 'com.esri.arcgisruntime:arcgis-android:100.7.0'

2、设置布局

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Map3DActivity">


    <com.esri.arcgisruntime.mapping.view.SceneView
        android:id="@+id/sceneview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

3、在Activity设置一下

    private void iniMap() {
        SceneView sceneview = findViewById(R.id.sceneview);
        sceneview.setAttributionTextVisible(false);//隐藏esri的log
        ArcGISScene arcGISScene = new ArcGISScene();
        ArcGISTiledLayer arcGISTiledLayer = new ArcGISTiledLayer("https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer");
        arcGISScene.setBasemap(new Basemap(arcGISTiledLayer));
        sceneview.setScene(arcGISScene);
        String elevation_image_service = "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";
        //将在线服务作为高程表面
        ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(elevation_image_service);
        arcGISScene.getBaseSurface().getElevationSources().add(elevationSource);

        String brest_buildings = "http://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Brest/SceneServer";
        //向场景中添加一个用于查看建筑物的场景服务
        ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(brest_buildings);
        arcGISScene.getOperationalLayers().add(sceneLayer);
        Camera camera = new Camera(48.388, -4.454, 200, 345, 65, 0);
        sceneview.setViewpointCamera(camera);
    }

到此就可以查看3D效果了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值