首页 / 浏览问题 / 移动GIS / 问题详情
Datasource打开失败
27EXP 2018年08月07日
版本9D supermap-imobile-9.0.1-103-android-zip-chs

使用下列方法打开数据服务失败 得到mDataSource=null的结果
DatasourceConnectionInfo dsInfo = new DatasourceConnectionInfo();
dsInfo.setEngineType(EngineType.Rest);
dsInfo.setServer(datasourceLink);
dsInfo.setAlias(alias);
mDataSource = mWorkspace.getDatasources().open(dsInfo);
其中datasourceLink = http://xxx/iserver/services/data-hdhj/rest/data/datasources/ORCL

求解

2 个回答

最后解决了 因为手机端能下载的数据服务数据集类型 目前只支持点、线、面,换成这三种类型的数据服务链接,就能下载成功了
27EXP 2018年08月10日
您好,不好意思,之前给你回答错了,数据服务不能直接打开。根据你的需求,你可以将数据服务下载到本地进行操作,可以参考一下我们的范例代码-数据服务。
9,127EXP 2018年08月07日

你好 下载数据服务的时候 用到的datasource报错requestFailed UnsupportedOperationException: create(DatasetVectorInfo datasetInfo)     The datasource is readonly.

下载时用到的参数数据源是这样定义的 :

mWorkspace = new Workspace();
DatasourceConnectionInfo dsInfo = new DatasourceConnectionInfo();
dsInfo.setEngineType(EngineType.Rest);
dsInfo.setServer("http://219.151.9.199:8090/iserver/services/map-smtiles-GZ4/rest/maps/GZ_XianQu");
dsInfo.setAlias("GZ");
mDataSource = mWorkspace.getDatasources().open(dsInfo);

但是Rest是只读类型 而OGC类型会打开失败

求解 怎样可以做到在上面地图的基础上 下载数据服务
能把两个都显示出来

你好,rest地图服务就是只读的啊,rest数据服务是可以编辑的。你说的两个都显示出来是什么意思。从服务器下载数据参考下面的代码:

已经参考示例代码了 但是下载的时候 这个数据源参数会报错

http://219.151.9.199:8090/iserver/services/map-smtiles-GZ4/rest/maps/GZ_XianQu这个地址的数据源 要如何打开成非只读数据源??
你这个服务类型是地图服务,将地址改数据服务的地址
downloadDataset()要传的参数不是数据源Datasource吗,如果数据源地址换成数据服务的地址,不是回到前面的问题了吗
你需要打开一个本地数据源,这个参数就是datasource就是本地数据源,下载得数据就是下到这个数据源中。实例代码第一步就是准备本地数据源。

想问下这个错是什么原因surpriserequestFailed java.lang.UnsupportedOperationException: add(FieldInfo fieldInfo)
    The operation is not supported by FieldInfos.



08-08 16:28:28.902 6712-7089/com.gzsl.riversmanager W/System.err:     at com.supermap.data.FieldInfos.add(FieldInfos.java:177)
        at com.supermap.services.DataDownloadService.a(DataDownloadService.java:770)
        at com.supermap.services.DataDownloadService.downloadFeatureSet(DataDownloadService.java:682)
        at com.supermap.services.DataDownloadService.downloadFeatureSet(DataDownloadService.java:614)
        at com.supermap.services.DataDownloadService.downloadDatasetFromServer(DataDownloadService.java:422)
        at com.supermap.services.DataDownloadService$2.run(DataDownloadService.java:331)
        at java.lang.Thread.run(Thread.java:764)

这个传得是FieldInfo,你传得是FieldInfos,所以会报这个错误。传得参数错误

我只是调用了

downloadService.downloadDataset("http://xxx/iserver/services/data-hdhj/rest/data/datasources/ORCL/datasets/shorelineArea", mDataSource);


这个错不知道什么原因导致的requestFailed java.lang.UnsupportedOperationException: add(FieldInfo fieldInfo)
    The operation is not supported by FieldInfos.
你把你代码发出来看一下,还有知道是哪一句报这个错误吗
if (addDatasource(DATA_SOURCE_SHORELINE, "DATA_SOURCE_SHORELINE")) {
    downloadService();
}

对应方法在下面


// 添加数据服务
public boolean addDatasource(String datasourceLink, String alias) {
    LogUtil.e(TAG, "addDatasource called  " + alias);

    DatasourceConnectionInfo connectionInfo = new DatasourceConnectionInfo();
    connectionInfo.setEngineType(EngineType.UDB);
    connectionInfo.setServer(filepath);

    mDataSource2 = mWorkspace.getDatasources().open(connectionInfo);

    if(mDataSource2 != null)
        return true;

    return true;
}


//下载数据集
public void downloadService() {
    LogUtil.e(TAG, "downloadService ");
    if (mDataSource2 == null) {
        LogUtil.e(TAG, "mDataSource2 == null ");
        return;
    }

    String urlServer = "http://xxx";
    DataDownloadService downloadService = new DataDownloadService(urlServer);
    downloadService.setResponseCallback(new ResponseCallback() {

        @Override
        public void requestFailed(String errorMsg) {
            LogUtil.e(TAG, "requestFailed " + errorMsg);

            ToastUtil.showShort(getContext(), "下载失败 " + errorMsg);
            if (errorMsg.contains("shorelineArea_Table already") && mMapControl != null) {
                mMapControl.getMap().refresh();
            }
        }

        @Override
        public void requestSuccess() {
            LogUtil.i(TAG, "requestSuccess");
        }

        @Override
        public void receiveResponse(FeatureSet result) {
            LogUtil.i(TAG, "receiveResponse " + result.toString());

        }

        @Override
        public void dataServiceFinished(String arg0) {
            LogUtil.i(TAG, "dataServiceFinished " + arg0);

            ToastUtil.showShort(getContext(), "下载成功 " + arg0);

            mMapControl.getMap().refresh();
        }

        @Override
        public void addFeatureSuccess(int arg0) {
            LogUtil.i(TAG, "addFeatureSuccess " + arg0);

        }

    });

    downloadService.downloadDataset(DATA_SOURCE_SHORELINE, mDataSource2);
}

报错处:supermap-imobile-9.0.1-103-android-zip-chs


08-08 17:06:33.690 8765-9015/com.gzsl.riversmanager W/System.err: java.lang.UnsupportedOperationException: add(FieldInfo fieldInfo)
    The operation is not supported by FieldInfos.
        at com.supermap.data.FieldInfos.add(FieldInfos.java:106)
        at com.supermap.services.DataDownloadService.a(DataDownloadService.java:617)

你加我一个qq:2889751134
...