arcgis javascript api學習3

來源:互聯網
上載者:User
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 outFieldsoutSpatialReference, 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)


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.