Limiting Feature Layer Popup based on another Feature Layer or Graphic?

524
1
05-22-2012 02:44 PM
ColeHarper
New Contributor
My problem is this:

I want all of my data to be displayed in a feature layer, but I only want a certain area defined by another Feature Layer or Graphic (I will call this the "Area of Interest Polygon" or AIP) to allow popups. Please see attached image for clarification

How do I override the feature layer's onclick to check if the point clicked is within the "AIP". Or if I place the "AIP" as the top level graphic layer how do I make it query the underlying feature layer?

Thanks

[ATTACH=CONFIG]14533[/ATTACH]
0 Kudos
1 Reply
StephenLead
Regular Contributor III
How do I override the feature layer's onclick to check if the point clicked is within the "AIP"


There are probably a couple of ways you could approach this. One might be:

- add FeatureLayer1 to the map, but don't assign it an infoWindow
- add the AIP layer/graphic to the map
- set an onClick listener on the AIP layer, which does something like this:

dojo.connect(AIPlayer, "onClick", function(evt) {
  var graphic = evt.graphic;
  var attributes = evt.graphic.attributes;
  var infoTemplate = new esri.InfoTemplate;
  //1. set the infoTemplate's Contents and Title using the attributes
  //2. attach the infoTemplate to map.infoWindow
  //3. display the map's infoWindow at evt.mapPoint
});

0 Kudos