在开发GIS项目的过程中,有时候需要加载一些公共的底图作为我们项目的底图数据,本文主要介绍加载使用频率高一些的天地图/百度/高德等底图
在官网帮助中也有相关说明
Extensible tile layers
This release provides APIs to display custom tiles. The WebTiledLayer is an extensible layer that requests map tiles from a web service based on a URI template. It provides a simple way to integrate non-ArcGIS Services as a layer in a map. Also, custom tiled layers can be created by sub-classing ImageTiledLayer and its subclass, ServiceImageTiledLayer. These two abstract classes expose protected abstract methods to either fetch tile images or return the URL of the tile images. By extending these two classes and implementing the abstract methods, you can create custom tiled layers and add them to a map.
简单点说,如果底图的切片地址可以用简单的缩放、行、列表达的话,就可以用WebTiledLayer
比如高德地图的矢量切片获取模板为:
http://webrd0{subDomain}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={col}&y={row}&z={level}
在上面的模板中可以看到x、y、z是直接用得行列和缩放等表示的,这种情况下就可以使用WebTiledLayer来加载啦,下面列举几个使用简单模板的底图:
高德矢量:http://webrd0{subDomain}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={col}&y={row}&z={level}
高德影像:http://webst0{subDomain}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=6&x={col}&y={row}&z={level}
高德透明道路和标注(用于叠加到影像):http://webst0{subDomain}.is.autonavi.com/appmaptile?style=8&x={col}&y={row}&z={level}
天地图矢量:[url]http://t{subDomain}.tianditu.com/DataServer?T=vec_c&x={col}&y={row}&l={level}[/url]
天地图影像:[url=http://t{subDomain}.tianditu.com/DataServer?T=img_cundefinedx={col}undefinedy={row}undefinedl={level}]http://t{subDomain}.tianditu.com/DataServer?T=img_c&x={col}&y={row}&l={level}[/url]
天地图标注信息(用于叠加影像数据,显示标注):http://t{subDomain}.tianditu.com/DataServer?T=cva_c&x={col}&y={row}&l={level}
以上模板是高德和天地图底图数据模板,使用方法:
var _layer = new WebTiledLayer("http://webst0{subDomain}.is.autonavi.com/appmaptile?style=8&x={col}&y={row}&z={level}", new List<string> { "1", "2", "3", "4" });
MyMapView.Map.Basemap.BaseLayers.Add(_layer)
今天就先把简单模板数据的加载写出来,下节将介绍自定义切片图层
runtime 100.1 中加载天地图/百度/高德/腾讯等底图(一):
http://zhihu.esrichina.com.cn/article/3246
runtime 100.1 中加载天地图/百度/高德/腾讯等底图(二):
http://zhihu.esrichina.com.cn/publish/article/3248