Programmatically trigger a click to a specific layer

11-06-2014 03:52 PM
Regular Contributor II


So Robert Scheitlin, GISP‌ helped me figure out how to fire a click event and re-route the Geocoder. Now I am able to have users enter an address and instead of the fairly worthless (in my humble opinion) popup that says, "Here's you address at this address" and puts a dot on the map as... now when the user enters their address and hits enter it fires a click event on the map which pops up the various popups configured for that map.

Trigger Layer(s) Popup with Feature.Geometry

So now I am looking for bigger and better things. Now I want to have it target just specific layers. If I have a map point and a screen point, how can I target a click (or popup) for just specific layers?

Any ideas?

1 Reply
MVP Esteemed Contributor


    Here is how you fire the popup for a specific layer featureLayer in this snippet (you have to figure out how to get the specific layer in the widget).

        on(geocoder, "find-results", function(results){

          var mpPt = results.results.results[0].feature.geometry;

          var scrPt = map.toScreen(mpPt);

, index, array){

            if (graphic.geometry.getExtent().contains(mpPt)){

              if (graphic.geometry.contains(mpPt)){



                return true;



            return false;




Don't forget to require "dojo/_base/array"