NYCPlanning / labs-regional-viz

An interactive mapping experience that highlights regional planning data and trends.
Other
6 stars 1 forks source link

Wrong polygons are being shown on NYC commuting maps #242

Closed hannahkates closed 5 years ago

hannahkates commented 5 years ago

On the NYC resident commuting maps (2nd and 6th maps), Putnam and Westchester counties should be joined together into one polygon on the map and one row in the popup table. On the NYC workers commuting maps (1st, 3rd, 4th, 5th), Putnam and Westchester counties should be separate, not joined together.

It seems like the polygons being used on the map are sticky, so the maps will show the incorrect set of polygons when you're navigating from one map to another.

Steps to reproduce:

  1. Go to https://metroexplorer-staging.planninglabs.nyc/Commuting/total-nycresidentwork#7.95/41.06/-73.693
  2. Hover over Putnam and Westchester counties and see that the two counties appear on the map as a single unioned polygon (correct display).
  3. Click the back arrow button, taking you to the first worker map (total-nycworkerres)
  4. Hover over Putnam and Westchester counties and see that the unioned geom is showing instead of them being shown individually (incorrect display)
  5. Hard refresh
  6. Hover over Putnam and Westchester counties and see that they are now split as expected (correct display)
  7. Click the "Learn more" button to move back to the total-nycresidentwork route
  8. Hover over Putnam and Westchester counties and see that they are split when they shouldn't be (incorrect display)
  9. Hard refresh
  10. Hover over Putnam and Westchester counties and see that the two counties appear on the map as expected a single unioned polygon (correct display)
chriswhong commented 5 years ago

This error is happen when transitioning between two maps that have identical id for the county layers. In this case a layer with id empty-polygons-county already exists on the map, and is never replaced with the new layer after the transition.

Since these layer ids are repeated throughout the app, the correct fix may be to append the map's slug when parsing the config yaml, so the layer name becomes `total-nycworkerres-empty-polygons-county.

hannahkates commented 5 years ago

Fixed in https://github.com/NYCPlanning/labs-regional-viz/commit/b5f49f6196109418dede73e4aad457541dad9d1a. The new unique layer IDs are hardcoded in the yaml files.