Arcgis Javascript API for query tasks on tiled map service

1834
8
08-28-2016 10:07 PM
DharmaRajan
Occasional Contributor

I'm using ArcGIS Javascript API 3.17 to view my point data from ArcGIS server 10.3. Initially I have published the point data as dynamic map service but it is taking too long time to render the data over web as my feature class has around 80,000 point features. So I've changed dynamic map service to tiled map service and generated the cache. Now it is rendering too fast from cached tiles. Now the issue is that I have to perform Query task on my data. For that I have few questions:

Is it require to add dynamic map service also under tiled service in the map to perform the query tasks? Or only passing dynamic map service URL to query task is enough? If so, How can we show the result features on map?

Please suggest me.

0 Kudos
8 Replies
FC_Basson
MVP Regular Contributor

You can do a normal Query Task (QueryTask | API Reference | ArcGIS API for JavaScript 3.17 ) or IdentifyTask (IdentifyTask | API Reference | ArcGIS API for JavaScript 3.17 ) on the REST endpoint of the cached service..

DharmaRajan
Occasional Contributor

Thanks

0 Kudos
FC_Basson
MVP Regular Contributor

And the results of the Query/Identify Task can be added to the map as part of a Graphics Layer (GraphicsLayer | API Reference | ArcGIS API for JavaScript 3.17 )

DharmaRajan
Occasional Contributor

Thanks a lot. Similarly how can we perform feature selection. please suggest

0 Kudos
FC_Basson
MVP Regular Contributor

Do you want to select by geometry or attribute?  The Query and Identify tasks can both return the geometries of the results.

0 Kudos
DharmaRajan
Occasional Contributor

Thanks. I am able to add result geometries in graphics layer for highlighting the result. Now I want to give the option to select the geometries on map using mouse cursor.

0 Kudos
FC_Basson
MVP Regular Contributor

You can use the "on" event for the graphics layer to access the graphics properties e.g.

mygraphicslayer.on("click", function(event) {
  // do stuff
});‍‍‍

Also have a look at the other graphics layer events: GraphicsLayer | API Reference | ArcGIS API for JavaScript 3.17 

DharmaRajan
Occasional Contributor

Thanks FC Basson

0 Kudos