Arcgis for Android 基本图层

    
    在10.2里MapView直接继承于ViewGroup类,本身就是地图内容的展示容器,使用时候直接在MapView可以加载各种基础底图、业务图层和绘制图层。

  • 切片数据图层(ArcGISTiledLayer

      切片数据主要用来做为底图的展示,包含渲染后的地图和地图的空间参考信息,其离线数据的格式为TPK。

说是新增,其实是将之前的ArcGISLocalTiledLayer类和ArcGISTiledMapServiceLayer类合并成一个,也就是说这个类既可以加载离线TPK数据,也可以加载在线切片数据。

 离线数据:

String url = StorageUtil.getSDCardRootPath(getApplicationContext()) + "/ydyzt/data/YGYX.tpk";
TileCache mainTileCache = new TileCache(url);
ArcGISTiledLayer layer = new ArcGISTiledLayer(mainTileCache);
 在线数据:
String theURLString ="http://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer";
ArcGISTiledLayer mainArcGISTiledLayer = new ArcGISTiledLayer(theURLString);
  • 矢量切片数据图层(ArcGISVectorTiledLayer

 矢量切片数据是ArcGIS10.4里推出的一种新数据,它在传统的切片数据的基础上同时打包了矢量数据,因此除了展示外,也可以提供查询的功能。其离线打包数据格式为VTPK。

      Runtime100里采用ArcGISVectorTiledLayer类来展示矢量切片数据,使用方法和ArcGISTiledLayer类相似:

     离线数据:

String url = StorageUtil.getSDCardRootPath(getApplicationContext()) + "/ydyzt/data/YGYX_YS.vtpk";
ArcGISVectorTiledLayer layer = new ArcGISVectorTiledLayer(mainTileCache);

      在线数据:

String theOfflineTiledLayers ="https://www.arcgis.com/home/item.html?id=e19e9330bf08490ca8353d76b5e2e658";
ArcGISVectorTiledLayer mainArcGISVectorTiledLayer = new ArcGISVectorTiledLayer(theOfflineTiledLayers);
  • 要素图层(FeatureLayer

要素信息是ArcGIS的最基本的信息,包含了矢量信息以及与之对应的表数据,可以用来进行展示、查询、分析、编辑等。其离线数据格式为geodatabase。

     Runtime100里依然保留了ArcGIS的经典图层——FeatureLayer,每个要素图层里都通过一个FeatureTable构造来。FeatureTable可以通过离线geodatabase获取,也可以通过在线的要素服务得到:

      离线数据:

String path=StorageUtil.getSDCardRootPath(getApplicationContext())+"/ydyzt/data/GD_TDYT.geodatabase";
final Geodatabase localGdb=new Geodatabase(path);
localGdb.loadAsync();
localGdb.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
        LayerList mainLayerList = arcGISMap.getOperationalLayers();
        for (GeodatabaseFeatureTable gdbFeatureTable : localGdb.getGeodatabaseFeatureTables()) {
                 FeatureLayer dataFeatureLayer = new FeatureLayer(gdbFeatureTable);
                 mainLayerList.add(dataFeatureLayer);}}});

      在线数据:

String mainFeatureLayerURL =
        "http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0";
final ServiceFeatureTable mainServiceFeatureTable = new ServiceFeatureTable(mainFeatureLayerURL);
mainServiceFeatureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_NO_CACHE);
mainServiceFeatureTable.addLoadStatusChangedListener(new LoadStatusChangedListener() {
    @Override
    public void loadStatusChanged(LoadStatusChangedEvent loadStatusChangedEvent) {
        if (loadStatusChangedEvent.getNewLoadStatus() == LoadStatus.LOADED) {
            ServiceFeatureTable.FeatureRequestMode mainFeatureRequestMode =
                    mainServiceFeatureTable.getFeatureRequestMode();
            String mainFeatureRequestModeName = mainFeatureRequestMode.name();
        }
    }
});
  • 动态地图图层(ArcGISMapImageLayer和ArcGISMapImageSublayer
      动态地图图层ArcGISMapImageLayer是通过访问动态地图服务MapService获取的,里面包含的是一个子图层集合SublayerList,通过这个子图层集合可以构造得到每个动态地图图层ArcGISMapImageSublayer:
String mainArcGISMapImageLayerURL =
        "http://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer";
final ArcGISMapImageLayer mainMapImageLayer = new ArcGISMapImageLayer(mainArcGISMapImageLayerURL);
mainMapImageLayer.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
        SublayerList mainSublayerList = mainMapImageLayer.getSublayers();
        ArcGISMapImageSublayer mainMapImageSublayer = (ArcGISMapImageSublayer) mainSublayerList.get(0);
    }
});
  • 移动地图数据包含的图层
      移动地图数据是ArcGIS10.5新推出的一种数据格式,其特点是将所有地图和数据资源打包,并且将数据存储于压缩的Mobile GDB中,因此可以进行展示、查询、分析等所有操作。相比TPK数据来数据更小,而对于geodatabase数据而言,其加载图层效率上有明显的优势。因为其获取图层的方式比较特殊,所以单独拿出来说明下。

      MMPK因为是将所有地图和数据资源打包,因此其直接获取到的是ArcGISMap,我们要获取要素图层,需要先获取到ArcGISMap以后,再从其中获取FeatureLayer。

String mainMMPKPath = StorageUtil.getSDCardRootPath(getApplicationContext())+"/ydyzt/data/SanFrancisco.mmpk";
final MobileMapPackage mainMobileMapPackage = new MobileMapPackage(mainMMPKPath);
mainMobileMapPackage.loadAsync();
mainMobileMapPackage.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
        LoadStatus mainLoadStatus = mainMobileMapPackage.getLoadStatus();
        if (mainLoadStatus == LoadStatus.LOADED) {
            List<ArcGISMap> mainArcGISMapL = mainMobileMapPackage.getMaps();
            ArcGISMap mainArcGISMapMMPK = mainArcGISMapL.get(0);            
            mMapView.setMap(mainArcGISMapMMPK);}}});

      除此以外,图层还有三维地图图层(ArcGISSceneLayer),基于微软必应地图的图层(BingMapsLayer),要素集合图层(FeatureCollectionLayer)







没有更多推荐了,返回首页