首先利用ArcMap制作离线地图资源tpk文件,打开ArcMap工具箱,Data Management Tools->Package->Create Map Tile Package,输入待制作的mxd文件,选择Tiling Format问PNG格式,选择输出Levl,点击OK即可生成。
创建ArcGis的Android Project,把刚建好的tpk文件放在移动终端的SD卡的SXXPT/base_map_tpk处,代码如下:
-
// 加载esri坐标系的地图
-
RelativeLayout layout = (RelativeLayout) findViewById(R.id.rlay_map);
-
LayoutParams layoutParams = new LayoutParams(LayoutParams.FILL_PARENT,
-
LayoutParams.FILL_PARENT);
-
MapView baseMap = new MapView(MainActivity.this,
-
SpatialReference.create(4490), null);
-
layout.addView(baseMap, 0, layoutParams);
-
// baseMap = (MapView) findViewById(R.id.map_base_map);
-
-
// 加载离线地图
-
ArcGISLocalTiledLayer offlineLayer = new ArcGISLocalTiledLayer("file:///mnt/sdcard/SXXPT/base_map.tpk");
-
baseMap.addLayer(offlineLayer);
阅读(1671) | 评论(0) | 转发(0) |