ArcGIS Runtime for .Net Quartz开发探秘(三):承接来自GIS服务器的服务

0
分享 2017-11-08
在上一篇博客中,我们已经在程序中添加了两个服务,一个是切片地图服务,另一个是三维场景服务。

这篇博客则会从整体上介绍几种常用服务的使用方式。

先解释两个名词:服务、图层
服务:服务器对外提供功能的单元
图层:应用程序组织要素的单元
服务和图层,表现在程序中是这样的:
<esri:ArcGISSceneLayer Name="BuildingsLayer" Source="http://scene.arcgis.com/arcgis ... gt%3B 
其中http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer是服务,ArcGISTiledLayer是图层。
动态地图服务&切片地图服务
动态地图服务:用户浏览地图的时候由Server临时绘制地图的一种服务。
切片地图服务:与动态地图服务不同,切片是事先绘制好缓存起来的,而动态地图服务则是在调用时,读取地图数据后临时绘制的。
MapService:在ArcGIS Server的服务中,一个MapService地图服务可能同时包含上面两种服务的服务能力(动态地图服务和切片地图服务)。通过各种终端发布至ArcGIS Server的MapService,默认会开启动态地图服务能力,但是不一定有切片地图服务能力。作为移动端开发人员,拿到的URL在结构上是看不出是否具有切片地图服务能力的,只能通过在浏览器上输入URL,在服务详情中产看。如下图,有Tile Info的MapService才有切片地图服务能力。


既然地图服务的URL一样,那怎么去区别使用呢?
使用MapService的哪种能力,要通过API去控制,要看程序用什么图层对象去承接MapService。
如果我用ArcGISMapImageLayer对象去承接,则使用的是动态地图服务的能力,如果使用的是ArcGISTiledLayer对象去承接,则使用的是切片地图服务的能力。
下面给出动态地图服务加载的代码和切片地图服务加载的代码。
<esri:Scene.OperationalLayers>
<esri:ArcGISMapImageLayer Source="http://services.arcgisonline.c ... gt%3B
<esri:ArcGISTiledLayer Source="http://services.arcgisonline.c ... gt%3B
<esri:ArcGISSceneLayer Name="BuildingsLayer"
Source="http://scene.arcgis.com/arcgis ... gt%3B
</esri:Scene.OperationalLayers>



一个服务同时有动态地图服务能力和切片服务能力的MapService,使用ArcGISMapImageLayer和使用ArcGISTiledLayer加载的最终效果一样,但是加载时间长短区别很大。切片地图服务是提前把每个比例尺下的地图切割成小块图片,保存在服务器上。这样客户端在访问地图时,直接获取需要的小块图片拼接成整幅地图,而不是由服务器动态创建出一幅图片再送到客户端,极大程度提高了访问速度。

要素服务
要素服务一般被用作要素在线编辑。服务的URL与MapServer的URL略有不同。示例URL:
http://sampleserver6.arcgisonl ... erver
要素服务的末尾不是MapServer,而是FeatureServer,并且在要素服务使用的过程中,往往是使用FeatureServer的具体图层。下面的代码展示了如何在地图中加载要素服务,至于要素服务怎么编辑,放到后面的内容中去探索。
Uri serviceUri = new Uri( "http://sampleserver6.arcgisonl ... 6quot;);
ServiceFeatureTable myFeatureTable =new ServiceFeatureTable(serviceUri);
myFeatureTable.FeatureRequestMode= FeatureRequestMode.OnInteractionNoCache;
FeatureLayer myFeatureLayer =newFeatureLayer(myFeatureTable);
myMap.OperationalLayers.Add(myFeatureLayer);

影像服务
影像服务这里不做过多介绍,这里给出一个影像服务的示例URL,并给出服务加载代码。
http://sampleserver6.arcgisonl ... erver
ImageServiceRaster serviceRaster = new ImageServiceRaster(new Uri("http://sampleserver6.arcgisonl ... 6quot;));
serviceRaster.Loaded += (s, e) =>
{
ArcGISImageServiceInfo serviceInfo = serviceRaster.ServiceInfo;
IReadOnlyList<RenderingRuleInfo> renderingRuleInfos = serviceInfo.RenderingRuleInfos;
RenderingRule renderingRule = new RenderingRule(renderingRuleInfos[3]);
serviceRaster.RenderingRule = renderingRule;
RasterLayer layer = new RasterLayer(serviceRaster);
};
serviceRaster.LoadAsync();

 

[b]ArcGIS Runtime for .Net Quartz开发探秘(一):ArcGIS Runtime SDK for .Net简介及开发必要准备:http://zhihu.esrichina.com.cn/article/3501 
ArcGIS Runtime for .Net Quartz开发探秘(二):构建第一个ArcGIS Runtime WPF应用程序:http://zhihu.esrichina.com.cn/article/3497​ 
ArcGIS Runtime for .Net Quartz开发探秘(三):承接来自GIS服务器的服务:http://zhihu.esrichina.com.cn/article/3492​ 
ArcGIS Runtime for .Net Quartz开发探秘(四):加载本地文件:http://zhihu.esrichina.com.cn/article/3495​ 
ArcGIS Runtime for .Net Quartz开发探秘(五):要素符号化及渲染器:http://zhihu.esrichina.com.cn/article/3505​ 
ArcGIS Runtime for .Net Quartz开发探秘(六):空间查询与识别:http://zhihu.esrichina.com.cn/article/3491​ 
ArcGIS Runtime for .Net Quartz开发探秘(七):外业数据采集-离线数据编辑:http://zhihu.esrichina.com.cn/article/3504 
ArcGIS Runtime for .Net Quartz开发探秘(八):三维:http://zhihu.esrichina.com.cn/article/3502
[/b]
 文章来源:http://blog.csdn.net/a__ant/article/details/77895381

0 个评论

要回复文章请先登录注册