ArcGIS调用离线地图

Cactus_hxk 2018-01-18 04:11:36
想做一个Arcgis调用离线地图用例,可怎么也不行,忘大神们帮帮忙啊,
代码如下:

private MapView mapView = null;
private ArcGISLocalTiledLayer local = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
this.mapView = (MapView)this.findViewById(R.id.map);//设置UI和代码绑定
String strMapUrl="http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer";
ArcGISTiledMapServiceLayer arcGISTiledMapServiceLayer = new ArcGISTiledMapServiceLayer(strMapUrl);
this.mapView.addLayer(arcGISTiledMapServiceLayer);
*/
String pathName = getSDPath()+"/arcgis/neimeng/Layers";
try
{
String inPath = Environment.getExternalStorageDirectory().getPath();
List<String> outPath = getExtSDCardPath();
Log.d("aaaaa","onCreate:++++++++++++++++++"+outPath.size());
for(String s : outPath){
Log.d("aaaaa","onCreate:++++++++++++++++++"+s);
}
Log.d("aaaaa","onCreate: ------------------------------------"+inPath);
File f=new File(pathName);
if(f.exists())
{
Log.d("","onCreate: ------------------------------------"+f.exists());
local = new ArcGISLocalTiledLayer("file://"+pathName);
mapView.addLayer(local);
}

}
catch (Exception e)
{

}

}


执行到这句时就报:local = new ArcGISLocalTiledLayer("file://"+pathName);
报错信息如下:
01-18 16:02:16.795 323-323/com.wd.hellomap D/aaaaa: onCreate:++++++++++++++++++0
01-18 16:02:16.795 323-323/com.wd.hellomap D/aaaaa: onCreate: ------------------------------------/storage/emulated/0

[ 01-18 16:02:16.796 323: 323 D/ ]
onCreate: ------------------------------------true
01-18 16:02:16.809 323-323/com.wd.hellomap E/ArcGIS: url =file:///storage/emulated/0/arcgis/neimeng/Layers
java.lang.RuntimeException: Error reading cache configuration!
at com.esri.android.map.ags.ArcGISLocalTiledLayer.nativeInitialize(Native Method)
at com.esri.android.map.ags.ArcGISLocalTiledLayer.initLayer(Unknown Source)
at com.esri.android.map.ags.ArcGISLocalTiledLayer.<init>(Unknown Source)
at com.esri.android.map.ags.ArcGISLocalTiledLayer.<init>(Unknown Source)
...全文
779 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Cactus_hxk 2018-01-18
  • 打赏
  • 举报
回复
代码: private MapView mapView = null; private ArcGISLocalTiledLayer local = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /* this.mapView = (MapView)this.findViewById(R.id.map);//设置UI和代码绑定 String strMapUrl="http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer"; ArcGISTiledMapServiceLayer arcGISTiledMapServiceLayer = new ArcGISTiledMapServiceLayer(strMapUrl); this.mapView.addLayer(arcGISTiledMapServiceLayer); */ String pathName = getSDPath()+"/arcgis/neimeng/Layers"; try { String inPath = Environment.getExternalStorageDirectory().getPath(); List<String> outPath = getExtSDCardPath(); Log.d("aaaaa","onCreate:++++++++++++++++++"+outPath.size()); for(String s : outPath){ Log.d("aaaaa","onCreate:++++++++++++++++++"+s); } Log.d("aaaaa","onCreate: ------------------------------------"+inPath); File f=new File(pathName); if(f.exists()) { Log.d("","onCreate: ------------------------------------"+f.exists()); local = new ArcGISLocalTiledLayer("file://"+pathName); mapView.addLayer(local); } } catch (Exception e) { } }

80,471

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧