首页 / 浏览问题 / 移动GIS / 问题详情
SuperMap iMobile 11i(2023) for Android,使用天地图地图数据,参考官方demo中的track目录代码绘制轨迹,创建createDataset失败
1EXP 2024年05月21日

报错信息:

            //初始化天地图
            val workspace = Workspace()
            binding.mapView.mapControl.map.workspace = workspace

            val info2 = DatasourceConnectionInfo()
            info2.alias = "TianDiWX"
            info2.engineType = EngineType.OGC
            info2.driver = "WMTS"
            info2.server = mTiandituUrl2
            dataset2 = workspace.datasources.open(info2).datasets[0]

            info = DatasourceConnectionInfo()
            info?.alias = "TianDi"
            info?.engineType = EngineType.OGC
            info?.driver = "WMTS"
            info?.server = mTiandituUrl
            dataset = workspace.datasources.open(info).datasets[0]
            binding.mapView.mapControl.map.layers.add(dataset2, true)
            binding.mapView.mapControl.gestureDetector = GestureDetector(gestureListener)

            binding.mapView.mapControl.map.isFullScreenDrawModel = true
            binding.mapView.mapControl.map.refresh()
            diyDraw = Draw(binding.mapView.mapControl)
            info2.dispose()
            info?.dispose()
            binding.mapView.mapControl.isMagnifierEnabled = true
            binding.mapView.mapControl.addMeasureListener(this)
            binding.mapView.mapControl.addGeometrySelectedListener(this)

绘制轨迹代码与官方demo中的track目录下代码一致,执行到creatDataset时报错

fun startLocation(){
        var data = binding.mapView.mapControl.map.workspace.datasources.get(0)
        var dataset = track?.createDataset(data,"track")
        track?.startTrack()
        m_EnableLocationService = false
        track?.dataset = dataset

        var layers = binding.mapView.mapControl.map.layers
        layers.add(dataset,true)
        m_EnableLocationService = true
        binding.mapView.mapControl.map.refresh()
        locating()
    }

1个回答

创建数据集需要在独占打开的文件型数据源中创建,天地图数据源是只读的,如果用天地图数据源或者用只读打开的文件型数据源,不可创建数据集,需要用独占打开的文件型数据源创建数据集,或者创建数据源再创建数据集

workspace.getDatasources().create根据指定的连接信息创建数据源

Datasets.create根据指定的矢量数据集信息来创建矢量数据集
3,745EXP 2024年05月21日
那需要怎么去创建或下载这种独占打开的文件型数据源
...