Get MapService on Map Click Event

1626
5
Jump to solution
02-23-2017 03:21 AM
PrasadG
New Contributor II

hi....

 I have task  when i click on map,  active layer information show on  popup window, it is possible with query task but i have  many map services and activate it dynamically. means whatever feature on map I want to show information when i click on feature without define map or feature service. I want to get feature on map service when click on respective feature then i want to query. is it possible ?.........Thanks

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

Take a look at this discussion, which returns the map service information for layers in different services.

Get an IdentifyParameter for an IdentifyTask result 

View solution in original post

5 Replies
FC_Basson
MVP Regular Contributor

What API version are you working with?

In 3.19 you can easily get the visible layers through the map objects different layer properties e.g. 

map.layerIds or map.graphicsLayerIds

Then you can check if the layer is visible, get the URL for the layer and get the layer properties as JSON through a standard request (https://[server]/arcgis/rest/services/[service]/MapServer/[layerID]/?f=pjson)

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Prasad, 


  You could use the IdentifyTask for this if you do not want to send a query to each individual layer.

0 Kudos
KenBuja
MVP Esteemed Contributor

Take a look at this discussion, which returns the map service information for layers in different services.

Get an IdentifyParameter for an IdentifyTask result 

PrasadG
New Contributor II

Thanks.... ken your code exactly match my requirement. it is very helpful for me..

0 Kudos
KenBuja
MVP Esteemed Contributor

If this answered your question, please click the Mark Correct button.

0 Kudos