arcgis_for_flex中queryTask 使用的问题
queryTask.url="http://localhost:8399/arcgis/rest/services/scMap/MapServer/"+cb.value;//设置查询语句
query.where=qText.text+" and FID is not null";
//查询结果是否返回Geometry
query.returnGeometry=true;
query.spatialRelationship="esriSpatialRelEnvelopeIntersects";
//设置要查询的字段
var fields:Array=new Array();
fields.push("FID");
fields.push("Shape");
fields.push("名称");
query.outFields=fields;
//进行查询成功调用onResult方法,错误失败调用onFault
queryTask.execute(query,new AsyncResponder(onResult,onFault));
执行后,如果查询的layer是点类型,没有任何问题,但是,如果查询的图层内容为面或者是线,则出现以下异常
TypeError: Error #1034: 强制转换类型失败:无法将 com.esri.ags.geometry::MapPoint@1cc14fb1 转换为 Array。
at com.esri.ags.geometry:olyline$/http://www.esri.com/2008/ags/internal::toPolyline()[C:\checkout\flex_api2\api\src\com\esri\ags\geometry\Polyline.as:78]
at com.esri.ags.geometry::Geometry$/http://www.esri.com/2008/ags/internal::toGeometry()[C:\checkout\flex_api2\api\src\com\esri\ags\geometry\Geometry.as:151]
at com.esri.ags::FeatureSet$/http://www.esri.com/2008/ags/internal::toFeatureSet()[C:\checkout\flex_api2\api\src\com\esri\ags\FeatureSet.as:325]
at com.esri.ags.tasks:ueryTask/handleExecute()[C:\checkout\flex_api2\api\src\com\esri\ags\tasks\QueryTask.as:318]
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.esri.ags.tasks::BaseTask/loaderCompleteHandler()[C:\checkout\flex_api2\api\src\com\esri\ags\tasks\BaseTask.as:770]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
谁知道是哪儿出问题了吗,环境 flex4+arcgis_for_flex2.5 arcgis flex --------------------编程问答-------------------- 参考:
ArcGIS.Server.9.3和ArcGIS API for Flex实现Query查询定位中心功能(七)
补充:企业软件 , 地理信息系统