about how ArcGIS for javascrept queries ArcGIS Server layer Information

Source: Internet
Author: User

Mode one: Querytask mode: This method is used for conditional queries on individual layers (cannot be queried across layers)

  1. Create a Query object

1 new esri.tasks.Query ();

2. Setting parameters for a query object

1 true ; 2 query.outfields = [' ID, name, ... ']  //  Query result set returned field 3 query.where = ' ID         = ' + ID; // Query Criteria

3. Create a Querytask object

1 new esri.tasks.QueryTask (' http://... ');  // Create a Querytask object with parameters that connect to the layer you want to query

4. Query and result set processing

1 // Pass the query object as a parameter to the Execute method, results as the result set 2   if (Results.features.length > 0) {    //  callback function 3...  // working with result sets 4   Else {5...  // result set is empty 6   }7 });

Mode two: Findtask mode: This method is used for fuzzy queries at multiple levels under the same layer (can be cross-layer and only fuzzy query)

  1. Create the Findtask object:

1 New // Layerurl Connection for the layer to be queried

2. Creating the Params Parameter object

1 New esri.tasks.FindParameters (); 2 params.layerids = [0, 1, 2, ...];     // set up a query layer list 3 params.searchfields = [' Swchname '];      // set the fields of the query layer to blur the query based on the Swchname field 4 params.searchtext = swchname;            // set keywords for fuzzy queries 5 true;            // returns the geometry of the spatial query so that the result of the return value is superimposed on the map in the form of an icon

3. Query and result set processing

1 // callback function 2     if (Results.length > 0) {3...  // working with result sets 4     Else {5...  // result set is empty 6     }7 });

about how ArcGIS for javascrept queries ArcGIS Server layer Information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.