Popups for Feature Layer When Feature is Overlapped by Graphics Layer

1888
6
10-10-2016 09:48 AM
chuckfrank
Occasional Contributor

Hello,

I built a map with several feature layers (points and lines) and a single graphics layer.  When the graphics layer is empty I can easily click on the points and view attributes in the popup template.  The popup template is set when the feature layer is declared and it all works as it should.  

The problem is when the graphics layer is populated and the graphic overlaps the feature layer points.  Then the popup displays with a blank results because it's querying against a graphic that doesn't have attributes.  I need to clear the graphics from the graphics layer in order to successfully view the popups again.

I've read in this forum that the graphics layer is always on top.  Is that true?  If it is, what approach to I need to take to prevent a popup on a graphic in a graphics layer, but allow popups for feature layers?

Thanks,

Chuck

6 Replies
JulieLopez1
New Contributor

Chuck,

Did you ever find a solution or workaround to this?

Thanks,

Julie

DrewDavenport
New Contributor

I also have this issue. I am using version 4.1.

0 Kudos
EvelynHernandez
Occasional Contributor III

I think i remember to solve this problem using a indicator on what position i want to add the graphic layer or layer to the map, like:

map.addLayer(mygraphiclayer,2)

map.addLayer(layer,1)

0 Kudos
DrewDavenport
New Contributor

Hey Evelyn, thanks for the response. I tried out your suggestion, but it didn't work for me. I've got the feature layer to appear on top of the graphic layer but the popup still doesn't display when clicking on a feature. Maybe the others will have more success.

0 Kudos
EvelynHernandez
Occasional Contributor III

Maybe if u provide a clear example of the code u have we can see whats wrong with it.

0 Kudos
jagadishk
New Contributor

Hey Chuck,

To avoid getting the info window of the graphics, You can use map.infowindow.hide() inside the on " Mouse-click" function for that particular graphics layer. 

Sample code:

graphicsLayer.on('mouse-click',function(){
      map.infowindow.hide();
})

Hope this should work.

Thanks,

Jagadish

0 Kudos