"Zoom-to" button on Popup hung after switch to a different feature layer

653
1
Jump to solution
07-21-2020 06:10 PM
Lu-chiaChuang
New Contributor III

Issue: "Zoom-to" button on Popup hung after switch to a different feature layer

I am working on a lightweight map viewer prototype which is configurable through a XML file. The map viewer uses HTML multi-level Select to switch between different feature layers. The XML file includes feature layer information, URLs, as well as popup contents. The main goal is to allow non-GIS web designers to embed this map viewer on their webpages.

Anyway, most functions seem to work on the prototype. There is one big issue - "Zoom-to" button on Popup hung after I switch to a different feature layer.

The code is on CodePen (https://codepen.io/ohiochuang/pen/OJMEWXr). 

Here is how to reproduce the problem.

  • Select a category, and select an indicator. A feature layer should show up.
  • Click a polygon on the layer. A popup should show up.
  • Click the "Zoom-to" button on the popup. The map will zoom into the selected area.
  • Select a different indicator. A different feature layer should show up.
  • Click a polygon on the new layer. A popup should show up. But this time, the "Zoom-to" button is spinning and hung.

My guess is the viewer get confused about the map extents of the second feature layer. I'm not really sure what to do. Any suggestion will be greatly appreciated. Thank you. 

Luke

0 Kudos
1 Solution

Accepted Solutions
Lu-chiaChuang
New Contributor III

Figured out what was the problem - every time I changed the feature layer, a new map is created. That was the issue. "Zoom to" on the popup window is working now. I got some hints from a Rice Kinder dashboard page. Thanks. 

View solution in original post

0 Kudos
1 Reply
Lu-chiaChuang
New Contributor III

Figured out what was the problem - every time I changed the feature layer, a new map is created. That was the issue. "Zoom to" on the popup window is working now. I got some hints from a Rice Kinder dashboard page. Thanks. 

0 Kudos