AnsweredAssumed Answered

Use buttons to add/remove layers

Question asked by mborr on Jul 18, 2014
Latest reply on Jul 21, 2014 by mborr

I'm using Javascript API legacy code to load feature layers when clicking a "create map" button.

 

Depending on which radio button (Male or Female) is selected, a different renderer is applied to the layer to create a choropleth map.

 

The "Create Map" button is working, the renderer is applied, and the proper choropleth appears like it should.

 

However, the problem is in the "Delete Map" button. I call a function that uses removelayer(ct). It works when I have clicked "Create Map" only once.

 

If I click "Create Map" twice, it creates two layers, and the "Delete Map" button will only remove the top layer; I want both layers removed that were created earlier. Here is the site (Javascript and HTML). Not sure how to insert code into the new forum.

 

 

 

 

 

http://homepages.wmich.edu/~m4borr/radio-generalize-test-render3.html

 

Thanks!

Outcomes