Class: QueryTask DescriptionExecutes a query operation on a layer resource of a map service exposed by the ArcGIS Server REST API(在基於ArcGIS Server REST API發布的地圖服務的一個圖層資源上執行一個查詢操作). ------------------------------------------------------------------------------------
Code snippets:(程式碼片段)
var queryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0");
Code snippets:
var query = new esri.tasks.Query();query.where = "STATE_NAME = 'Washington'";query.outSpatialReference = {wkid:102100}; query.returnGeometry = true;query.outFields = ["CITY_NAME"];queryTask.execute(query, addPointsToMap);
----------------------------------------------------------------------------------
execute(parameters, callback?, errback?)
Executes a Query against an ArcGIS Server map layer(執行針對ArcGIS Server Map Layer的查詢). The result is returned as a FeatureSet(結果作為FeatureSet返回).
If the query is successful, the user-specified callback function is invoked with the result(如果查詢成功了,使用者自訂的函數被觸發,這個函數返回一個FeatureSet).
A FeatureSet contains an array of Graphic features(一個FeatureSet包含一個Graphic集合), which can be added to the map using Map.graphics.add().
This array will not be populated if no results are found.
The return object of dojo.Deferred
was added at v1.4.Return value: dojo.DeferredInput Parameters:
<Query> parameters |
Required |
Specifies the attributes and spatial filter of the query. |
<Function> callback |
Optional |
The argument passed to the callback function, which is a FeatureSet. |
<Function> errback |
Optional |
An error object is returned if an error occurs on the Server during task execution. (As of v1.3) |
Code snippets:var query = new esri.tasks.Query();query.where = "STATE_NAME = 'Washington'";query.outSpatialReference = {wkid:102100}; query.returnGeometry = true;query.outFields = ["CITY_NAME"];queryTask.execute(query, addPointsToMap);
------------------------------------------------------------------------------------
__________________________________________________________________________________________________________________________
Class: Query Description dojo.require("esri.tasks.query")Query for input to the QueryTask(Query作為QueryTask的輸入參數). Not all query properties are required to execute a QueryTask(在執行一個QueryTask中並不是所有的查詢屬性都是必須的). The query definition requires one of the following properties: queryGeometry, text, or where(Query的定義中至少需要如下屬性之一:queryGeometry,text,或者where). Optional properties include
outFields,
outSpatialReference, and
returnGeometry(可選的屬性包括 outFields,outSpatialReference,和returnGeometry).______________________________________________________________________________________________________________________________Class: FeatureSet DescriptionA collection of features returned from ArcGIS Server or used as input to tasks. Each feature in the FeatureSet may contain geometry, attributes, symbolgy, and an InfoTemplate(每個在FeatureSet中的feature包含幾何形狀,屬性,符號和infotemplate). If the FeatureSet does not contain geometry, and only contains attributes, the FeatureSet can be treated as a table where each feature is a row object. Tasks that return FeatureSet include QueryTask, Geoprocessor, and RouteTask(返回FeatureSet的任務包括QueryTask,Geoprocessor,RouteTask). In addition, Geoprocessor and RouteTask may require FeatureSet as input.Class hierarchyesri.tasks.FeatureSet
****************************************************************************************************************************
根據zhyxk的資料庫結構提出如下解決方案:
1、javascript調用webservice擷取查詢到的dataset並擷取四個角點座標作為graphic添加到map預設的graphiclayer上(期間還考慮過javascript函數和C#函數之間的資料傳遞問題,
相當於javascript間接擷取webservice返回的dataset)
2、使用query和querytask查詢mapservice中的某個layer得到的結果也是作為graphic添加到map預設的graphiclayer上(前提是要準備好參與查詢的mapservice)