ArcGis for android 加载tpk离线文件(http://blog.csdn.net/vpingchangxin/article/details/8778869)
2014-07-30 15:49
609 查看
ArcGis for android 加载tpk离线文件
1.安装 arcgis android sdk (必须安装过 android sdk及 adt 环境喲)
创建一个本地缓存arcgis android项目
如下代码
[java] view
plaincopy
package com.esri.arcgis.android.samples.localtiledlayer;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import com.esri.android.map.MapView;
import com.esri.android.map.ags.ArcGISLocalTiledLayer;
/**
* This sample illustrates the use of ArcGISLocatlTiledLayer where the data is stored locally on the device, therefore
* this layer can function even when the device does not have any network connectivity. The data for this layer must be
* in an ArcGIS Compact Cache format (Tile Packages or .tpk's are not currently supported).
* The typical compact cache structure is as follows:
* <CacheName><br>
* Layers<br>
* _allLayers<br>
* conf.cdi,conf.xml<br>
* The path used in the constructor of the ArcGISLocalTiledLayer must point to the Layers folder e.g. <br>
* ArcGISLocalTiledLayer local = new ArcGISLocalTiledLayer("file:///mnt/sdcard/<CacheName>/Layers");
*
* A sample data set has been created and is available via ArcGIS Online:
* http://www.arcgis.com/home/item.html?id=d2d263a280164a039ef0a02e26ee0501
* 1) In order to use the data, download it from the url above
* 2) Copy the data to your sdcard
* 3) Set the path to the data by replacing <CacheName> with file:///mnt/sdcard/Parcels/v101/Parcel Map
* on line60 below.
*
* You can also use your own data if it is in an ArcGIS Compact Cache format, for more information on
* this data format see this link:
* http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2010/05/27/Introducing-the-compact-cache-storage-format.aspx
*
**/
public class LocalTiledLayer extends Activity {
MapView map = null;
ArcGISLocalTiledLayer local;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
map = (MapView) findViewById(R.id.map);
//the data is stored on the SDCARD
//the data is created as a tiled cache
// local = new ArcGISLocalTiledLayer("file:///mnt/sdcard/ArcGIS/Basemap/Layers");
// local = new ArcGISLocalTiledLayer(Environment.getExternalStorageDirectory()
// + "/YX1.tpk"); // 不行
local = new ArcGISLocalTiledLayer("file:///storage/sdcard0/YX1.tpk"); // ok
map.addLayer(local);
}
}
项目截图:
运行截图
1.安装 arcgis android sdk (必须安装过 android sdk及 adt 环境喲)
创建一个本地缓存arcgis android项目
如下代码
[java] view
plaincopy
package com.esri.arcgis.android.samples.localtiledlayer;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import com.esri.android.map.MapView;
import com.esri.android.map.ags.ArcGISLocalTiledLayer;
/**
* This sample illustrates the use of ArcGISLocatlTiledLayer where the data is stored locally on the device, therefore
* this layer can function even when the device does not have any network connectivity. The data for this layer must be
* in an ArcGIS Compact Cache format (Tile Packages or .tpk's are not currently supported).
* The typical compact cache structure is as follows:
* <CacheName><br>
* Layers<br>
* _allLayers<br>
* conf.cdi,conf.xml<br>
* The path used in the constructor of the ArcGISLocalTiledLayer must point to the Layers folder e.g. <br>
* ArcGISLocalTiledLayer local = new ArcGISLocalTiledLayer("file:///mnt/sdcard/<CacheName>/Layers");
*
* A sample data set has been created and is available via ArcGIS Online:
* http://www.arcgis.com/home/item.html?id=d2d263a280164a039ef0a02e26ee0501
* 1) In order to use the data, download it from the url above
* 2) Copy the data to your sdcard
* 3) Set the path to the data by replacing <CacheName> with file:///mnt/sdcard/Parcels/v101/Parcel Map
* on line60 below.
*
* You can also use your own data if it is in an ArcGIS Compact Cache format, for more information on
* this data format see this link:
* http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2010/05/27/Introducing-the-compact-cache-storage-format.aspx
*
**/
public class LocalTiledLayer extends Activity {
MapView map = null;
ArcGISLocalTiledLayer local;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
map = (MapView) findViewById(R.id.map);
//the data is stored on the SDCARD
//the data is created as a tiled cache
// local = new ArcGISLocalTiledLayer("file:///mnt/sdcard/ArcGIS/Basemap/Layers");
// local = new ArcGISLocalTiledLayer(Environment.getExternalStorageDirectory()
// + "/YX1.tpk"); // 不行
local = new ArcGISLocalTiledLayer("file:///storage/sdcard0/YX1.tpk"); // ok
map.addLayer(local);
}
}
项目截图:
运行截图
相关文章推荐
- ArcGis for android 加载tpk离线文件
- Arcgis for Android加载tpk文件遇到的错误
- Arcgis for Android加载tpk文件遇到的错误,求大神指导下。
- ArcGIS for Android 离线数据图例加载
- arcgis for android 离线切片加载与geodatabase查询
- 3种方法快速制作tpk文件(http://blog.csdn.net/arcgis_mobile/article/details/8048549)
- Arcgis for android 离线查询
- ArcGIS Api For Android学习之(二)加载地图
- arcgis api for javascript 离线部署后,加载高德地图 本地加载测试已成功
- Arcgis For Android之离线地图实现的几种方式
- ArcGIS for Android实现地图加载、放大缩小及定位功能
- 关于arcgis for android demo中加载自己发布的地图服务出错
- ArcGIS for Android 加载自己发布的地图却不显示
- 使用Arcgis API for android加载OpenStreetMap底图并完成定位
- arcgis for android之加载移动地图包
- Arcgis for Android 加载离线地图报错:com.esri.core.io.EsriServiceException: Unauthorized
- ArcGIS for Android离线数据编辑实现原理
- ArcGIS for Android 离线数据编辑原理
- Arcgis For Android之离线地图实现的几种方式
- Arcgis For Android之离线地图实现的几种方式