【ArcGIS Runtime SDK for Android-03】Layers and tables

图层显示地图或场景中的地理数据。地图和场景是图层和表的容器。表是数据的来源;表中的地理数据可以由某些类型的图层使用。Runtime支持多种类型的图层。

layer displays geographic data in a map or scene. Maps and scenes are containers for layers and tables. A table is a source of data; geographic data in tables can be consumed by some types of layers. Runtime supports many types of layers.

图层在你的地图中有两种角色:

  • 基础地图图层(Basemap layers )provide context for the information in your map. For example, the imagery or street map backgrounds on consumer mapping services are basemaps.
  • 操作图层(Operational layers): contain the primary content of the map. For example, a layer with all of the gas stations nearby would be an operational layer.

在Runtime中图层能够被当作操作图层或者基础地图图层,你可以灵活地使用图层。图层定义信息如何显示。它们可以使用来自表、本地文件或远程服务的数据。如果只需要在地图上放置点,或者使用没有底层模型的临时数据,那么可以考虑使用图形(graphic)。

一、Layer

1、常见的图层属性

所有的图层都支持以下常见特性:

  • Name — a human-readable name
  • Description — a human-readable description of the layer's content
  • Extent — the geographic area that contains the layer's content
  • Spatial reference — defines how coordinates should be interpreted. See Spatial references for more information.
  • Visibility — lets you hide or show the layer without removing it from the map.
  • Scale range — controls layer visibility based on how far the user has zoomed into the map using the MinScale and MaxScale properties.
  • Opacity

2、为地图选择图层

当为应用程序选择图层类型时,可以考虑以下问题:

  • Do users need to compare data with a time component?
  • Do users have an always-on internet connection?
  • Do users need to be able to query, analyze, or select data?
  • Do users need to be able to edit layer content
  • Do you or your users need control over the style (colors, fill patterns, icons, etc.) of the layer?
  • Does your app need to interoperate with other systems or ArcGIS Portal?

(1)选择基础地图图层

基础地图是地图的基础,为数据提供背景,定义地图整体风格。选择正确的基础地图能够:

  • Align your map with your brand
  • Help tell your story
  • Make your map layers and graphics easier to see and understand
  • Make your app feel like a part of your user's Geographic Information System (GIS) when your app connects to portal

【ArcGIS Runtime SDK for Android-03】Layers and tables

在ArcGIS Online上有许多有吸引力的基础地图。如果您正在创建编辑或浏览体验,您的用户可能已经习惯于通过门户使用某些基础地图。此外,您可以在用户的ArcGIS门户中获得一组功能基本地图,也可以发布您自己的基础地图或自定义现有矢量基础地图的样式。

【ArcGIS Runtime SDK for Android-03】Layers and tables

3、时态感知(Time-aware)图层

虽然所有图层都支持地理信息,但是时间感知图层也支持时间信息。当一个图层支持时间,你可以:

  • 根据时间过滤图层内容
  • 使用时间偏移量比较数据

【ArcGIS Runtime SDK for Android-03】Layers and tables

4、Image adjustment layers

Image adjustment layers allow you to change brightness, contrast, and gamma for imagery. See Layer types described for more information

5、图层性能考虑

(1)矢量&栅格数据

矢量和栅格数据是展示和管理地理数据的两种主要格式。

  • Vector — data is described by points, lines, and polygons (vectors). The client renders the vector content into raster images for display on the device.
  • Raster — data is transmitted via pre-rendered images; the client doesn't have information about the underlying features that were rendered into the image.

因为矢量图层是在设备上呈现的,所以它们总是非常适合客户端显示的大小和分辨率。矢量数据也非常小,非常适合离线或在低带宽环境中使用。矢量不适合表示来自栅格源(如卫星图像)的数据。

一些基础地图结合栅格和矢量数据,例如:ArcGIS Online的world images with streets (vector) 基础地图使用栅格切片图层作为图像,矢量图层作为要素和标注。这确保了显示栅格图像时,要素和标注总是清晰的。

(2)动态和切片图层

服务可以采用两种方法之一来提供数据。

  • Dynamic — Generate a map for each request based on information provided by the client, like desired image size & extent.
  • Tiled — Generate tiles ahead of time, then serve them as needed by the client.

因为动态地图是根据需要生成的,所以它们更适合于具有经常更改的数据的地图。动态地图的缺点是它们需要更多的服务器资源——渲染地图图像是一项昂贵的操作。对于不经常更改的内容,切片服务更合适。

二、表(Tables)

表提供了可以直接使用的数据源,或者可能显示在要素图层中。ArcGIS中的表为要素定义了一个模式——要素应该具有的一组一致的字段。表可以有许多要素。空间表中的项(Entries )可以具有几何图形。表可以来自:

  • Shapefiles
  • Geopackages
  • Maps
  • Feature services
  • Geodatabases

表的功能:

  • Queried
  • Edited (depending on the source)
  • Shown in a feature layer
  • Taken offline

补充:Non-spatial tables

非空间表与其他表一样,只是它们没有几何列。因为它们没有几何形状,所以不能在图层中呈现。虽然不能呈现非空间表,但仍然可以将它们添加到地图中作为查询的数据源。空间表中的特征(项)可以与非空间表中的特征相关。非空间表由与空间表相同的Runtime类型表示。

1、Table performance concepts

一个表可能有数十万个要素记录。应用程序如何从表中请求要素记录是一个性能关键决策。

在处理来自服务(而不是本地文件)的表时,要素记录请求模式控制检索要素的频率和缓存方式。有三种功能请求模式:

  • On interaction cache (default) 
  • Manual cache 
  • On interaction, no cache

参考链接:

https://developers.arcgis.com/android/latest/guide/layers.htm