本文原创,转载请注明原创地址 http://blog.csdn.net/dongyu1009/article/details/37697389

用AGSImageServiceIdentifyTask能够获取ArcGISImageServiceLayer图层中的栅格值。这涉及了三个比較重要的类:AGSImageServiceIdentifyParameters、AGSImageServiceIdentifyTask和AGSImageServiceIdentifyResult,另一个delegate代理类。以下一一简单介绍一下:

AGSImageServiceIdentifyParameters

AGSImageServiceIdentifyParameters是用来设置identify參数的。能够用类方法imageServiceIdentifyParameters构造,即

[AGSImageServiceIdentifyParameters AGSImageServiceIdentifyParameters];

AGSImageServiceIdentifyParameters共包含以下几个属性

---geometry用于指定查询栅格的位置。经常是一个AGSPoint,也能够用AGSPolygon来查询一个区域的栅格值。

---mosaicRule是镶嵌规则。默觉得AGSMosaicMethodCenter。

---pixelSizeX和pixelSizeY用来设置象元大小,默觉得被查询栅格图层的象元大小。在象元大小范围内的全部镶嵌数据集都会被查询到。

AGSImageServiceIdentifyTask

实例化的时候须要设置查询的URL,假设须要验证的话须要设置credential

其它的没什么可介绍的,在查询的之前已经要为查询设置代理,查询的时候用- (NSOperation*) identifyWithParameters:(AGSImageServiceIdentifyParameters *)      identifyParams方法。

AGSImageServiceIdentifyResult

catelogItems是返回的栅格文件夹(我也不知道怎么翻译啦,一个Raster Catelog是Raster Dataset栅格数据集的集合)。

catalogItemVisibilities顾名思义,栅格文件夹是否可见

location就是identify的查询位置

name就是identify查询的属性名称

objectId不解释了。就是一个id

properties是一个属性的集合

value就是name相应属性的象元值

AGSImageServiceIdentifyDelegate

代理是用来获得查询结果用的。必须实现以下两个方法,第一个是identify查询失败的时候调用的,第二个是identify查询成功调用的,会获得一个AGSImageServiceIdentifyResult对象。

(void)     - imageServiceIdentifyTask:operation:didFailToIdentifyWithError:

(void)     - imageServiceIdentifyTask:operation:didIdentifyWithResult:

以下是详细的用法。

1、为ViewController设置代理,并实现查询完毕的两个方法:

在ViewController.h中

#import <UIKit/UIKit.h>
#define IMAGE_SERVICE "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/World/MODIS/ImageServer"</p>

@interface ViewController : UIViewController <AGSImageServiceIdentifyDelegate>

@property (strong, nonatomic) AGSImageServiceIdentifyTask *task;

@end

在ViewController.m中

- (void)imageServiceIdentifyTask:(AGSImageServiceIdentifyTask*)identifyTask operation:(NSOperation*)op didIdentifyWithResult:(AGSImageServiceIdentifyResult *)result{
NSLog(@"properties :%@", result.properties);
NSLog(@"value :%@", result.value);
NSLog(@"name : %@", result.name);
NSLog(@"catalogItems count :%d", [[result.catalogItems features] count]);
} - (void)imageServiceIdentifyTask:(AGSImageServiceIdentifyTask*)identifyTask operation:(NSOperation*)op didFailToIdentifyWithError:(NSError *)error{
NSLog(@"fault");
}

2、设置AGSImageServiceIdentifyTask:

    self.task = [[AGSImageServiceIdentifyTask alloc] initWithURL:[NSURL URLWithString:IMAGE_SERVICE]];
self.task.delegate = self;

3、设置AGSImageServiceIdentifyParameters:

    AGSImageServiceIdentifyParameters *param = [AGSImageServiceIdentifyParameters imageServiceIdentifyParameters];

    param.geometry = [AGSPoint pointWithX:116.425541 y:39.969147 spatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326]];

    [self.task identifyWithParameters:param];

完整的代码例如以下:

ViewController.h中

//  ViewController.h
// Wang
//
// Created by dongyu on 14-7-10.
// Copyright (c) 2014年 org.reach. All rights reserved.
// #import <UIKit/UIKit.h> @interface ViewController : UIViewController <AGSImageServiceIdentifyDelegate> @property (strong, nonatomic) AGSImageServiceIdentifyTask *task; @end

在ViewController.m中

//  ViewController.m
// Wang
//
// Created by dongyu on 14-7-10.
// Copyright (c) 2014年 org.reach. All rights reserved.
// #import "ViewController.h"
#define IMAGE_SERVICE @"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/World/MODIS/ImageServer" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad]; self.task = [[AGSImageServiceIdentifyTask alloc] initWithURL:[NSURL URLWithString:IMAGE_SERVICE]];
self.task.delegate = self; AGSImageServiceIdentifyParameters *param = [AGSImageServiceIdentifyParameters imageServiceIdentifyParameters]; param.geometry = [AGSPoint pointWithX:116.425541 y:39.969147 spatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326]]; [self.task identifyWithParameters:param]; } - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} #pragma mark - delegate
- (void)imageServiceIdentifyTask:(AGSImageServiceIdentifyTask*)identifyTask operation:(NSOperation*)op didIdentifyWithResult:(AGSImageServiceIdentifyResult *)result{
NSLog(@"properties :%@", result.properties);
NSLog(@"value :%@", result.value);
NSLog(@"name : %@", result.name);
NSLog(@"catalogItems count :%d", [[result.catalogItems features] count]);
} - (void)imageServiceIdentifyTask:(AGSImageServiceIdentifyTask*)identifyTask operation:(NSOperation*)op didFailToIdentifyWithError:(NSError *)error{
NSLog(@"fault");
} @end

demo的下载地址:

http://download.csdn.net/detail/dongyu1009/7623695

新手发博文,有不好的地方,望大家批评指正。

ArcGIS Runtime SDK for iOS中获取ImageServiceLayer的栅格值的更多相关文章

  1. ArcGIS Runtime SDK for iOS开发地图图层-图形图层

    注:本文翻译自:https://developers.arcgis.com/ios/objective-c/guide/creating-a-graphics-layer.htm        创建图 ...

  2. ArcGIS Runtime SDK for iOS之符号和渲染

    符号定义了图形外观的非地理方面.它包括了图形的颜色.线宽.透明度等等.ArcGIS Runtime SDK for iOS包含了许多符号类,其中的每个类可以让你以独特的方式指定符号.每个符号的类型也是 ...

  3. ArcGIS Runtime SDK for iOS开发系列教程(5)——要素信息的绘制

    在客户端绘制点.线.面要素是GIS应用的基本功能,这一讲我将向大家介绍在iOS中如何来实现这一功能.大家都知道在Flex.Silverlight.js中对于要素的绘制都有一个叫GraphicsLaye ...

  4. ArcGIS Runtime SDK for Android中SimpleFillSymbol.Style样式

    SimpleFillSymbol.Style样式枚举共8种: 1.BACKWARD_DIAGONAL 反对角线填充 2.CROSS 交叉线填充 3.DIAGONAL_CROSS 前后对角线填充 4.F ...

  5. ArcGIS runtime sdk for wpf 授权

    这两天由于runtime sdk for wpf的授权和runtime sdk 其他产品的授权的不一样导致自己混乱不堪. 总结下吧. sdk 简介 当前ArcGIS runtime sdk 包括一系列 ...

  6. 《ArcGIS Runtime SDK for Android开发笔记》——(3)、ArcGIS Runtime SDK概述

    1.前言 ArcGIS Runtime SDK是一整套用于构建原生及跨平台的地图应用程序的开发包,包括移动设备的Android.iOS.Windows Phone,针对桌面的.Net.Java.OSX ...

  7. 《ArcGIS Runtime SDK for Android开发笔记》——(15)、要素绘制Drawtools3.0工具DEMO

    1.前言 移动GIS项目开发中点线面的要素绘制及编辑是最常用的操作,在ArcGIS Runtime SDK for iOS 自带AGSSketchLayer类可以帮助用户快速实现要素的绘制,图形编辑. ...

  8. 《ArcGIS Runtime SDK for Android开发笔记》——(11)、ArcGIS Runtime SDK常见空间数据加载

    ArcGIS Runtime SDK for Android 支持多种类型空间数据源.每一种都提供了相应的图层来直接加载,图层Layer是空间数据的载体,其主要继承关系及类型说明如下图所示: 转载请注 ...

  9. 《ArcGIS Runtime SDK for Android开发笔记》——(9)、空间数据的容器-地图MapView

    1.前言 在上一篇内容里介绍了 关于ArcGIS Android开发的未来(“Quartz”版Beta)相关内容,期间也提到了关于API接口的重构,开发思路的调整,根据2015UC资料也可以知道新版预 ...

随机推荐

  1. 个人软件过程(psp)需求分析

    个人软件过程(psp)需求分析 1.  引言 1.1  背景 开发项目进度计划不准确,延期经常出现,甚至无法给出一个比较准确的延迟时间,给市场推广带来很大麻烦. 2.  任务概述 2.1 目标 PSP ...

  2. 测试端口是否开放用PIN还是telnet命令

    有时候很想知道一个IP的某个端口是否开放,那么你会用什么命令来测试呢?是ping还是telnet? 其实正确的方法应该是telnet命令.因为用ping命令的话不管你ping哪个端口,只要这个IP地址 ...

  3. 3星|林毅夫《战胜命运》:事实证明华盛顿共识是错误的,GIFF是穷国发展正道。

    本书是林毅夫与喀麦隆一位经济学家合著.基本的观点是:事实证明华盛顿共识是错误的,GIFF是穷国发展正道.GIFF的主要思想是政府找到对标国家,强力推行产业政策. 作为一个经济学外行,读后感觉关于华盛顿 ...

  4. java中随机生成字符串的方法(三种)

    org.apache.commons.lang(2.6): 链接:https://pan.baidu.com/s/1k_oeA5AjSt6evoR7zT8gpQ 提取码:yhl5 1.生成的字符串每个 ...

  5. Python学习-变量

    什么是变量? 概念:变量就是会变化的量,主要是“变”与“量”二字.变即是“变化”. 特点:与其他编程语言相同,变量是最基本的存储单位,是用来存放数据的容器.可以引用一个具体的数值,进而直接去改变这个引 ...

  6. 每日命令:(6)rmdir

    今天学习一下linux中命令: rmdir命令.rmdir是常用的命令,该命令的功能是删除空目录,一个目录被删除之前必须是空的.(注意,rm - r dir命令可代替rmdir,但是有很大危险性.)删 ...

  7. 51nod 1285 山峰和分段

    [题解] 枚举n的各个因数作为段长,O(n)判断每一段内是否有山峰即可. #include<cstdio> #include<cstring> #include<algo ...

  8. BZOJ 1832、1787 洛谷 4281 [AHOI2008]紧急集合

    [题解] 题目要求找到一个集合点,使3个给定的点到这个集合点的距离和最小,输出集合点的编号以及距离. 设三个点为A,B,C:那么我们可以得到Dis=dep[A]+dep[B]+dep[C]-dep[L ...

  9. 【Codeforces 484A】Bits

    [链接] 我是链接,点我呀:) [题意] 让你求出l~r当中二进制表示1的个数最多的数x [题解] 最多有64位 我们可以从l开始一直增大到r 怎么增大? 找到l的二进制表示当中0所在的位置 假设i这 ...

  10. POJ 1226 Substrings

    Substrings Time Limit: 1000ms Memory Limit: 10000KB This problem will be judged on PKU. Original ID: ...