Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

remove layer reset for natural events, add zoom fix for polygon types

Ed Platoc5665e30d5c7
diff --git a/web/js/natural-events/ui.js b/web/js/natural-events/ui.js
index a0a17516e..57052c2f5 100644
--- a/web/js/natural-events/ui.js
+++ b/web/js/natural-events/ui.js
@@ -455,8 +455,6 @@ export default function naturalEventsUI (models, ui, config, request) {
var activateLayersForCategory = function (category) {
category = category || 'Default';
- // remove current layers
- models.layers.reset();
let currentProjection = models.proj.selected.id;
// Turn on the relevant layers for the event type based on projection and category
var layers = model.layers[currentProjection][category];
@@ -491,6 +489,11 @@ export default function naturalEventsUI (models, ui, config, request) {
? olExtent.boundingExtent(olProj.transform(geometry.coordinates[0], 'EPSG:4326', models.proj.selected.crs))
: olProj.transform(geometry.coordinates, 'EPSG:4326', models.proj.selected.crs);
+ // handle extent transform for polar
+ if (geometry.type === 'Polygon' && models.proj.selected.id !== 'geographic') {
+ coordinates = olProj.transformExtent(coordinates, 'EPSG:4326', models.proj.selected.crs);
+ };
+
return ui.map.animate.fly(coordinates, zoom);
};