Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

update to ol5

Mike McGanne75834fe3457
diff --git a/web/js/data/results.js b/web/js/data/results.js
index ab64d52fb..03b49201b 100644
--- a/web/js/data/results.js
+++ b/web/js/data/results.js
@@ -5,7 +5,7 @@ import OlGeomMultiPoint from 'ol/geom/MultiPoint';
import OlFormatGeoJSON from 'ol/format/GeoJSON';
import OlGeomPolygon from 'ol/geom/Polygon';
import OlGeomPoint from 'ol/geom/Point';
-import olExtent from 'ol/extent';
+import * as olExtent from 'ol/extent';
import lodashEach from 'lodash/each';
import { dataCmrRoundTime, dataCmrGeometry } from './cmr';
import util from '../util/util';
diff --git a/web/js/data/ui.js b/web/js/data/ui.js
index 87982cbaf..714f59e02 100644
--- a/web/js/data/ui.js
+++ b/web/js/data/ui.js
@@ -2,7 +2,7 @@ import $ from 'jquery';
import lodashSize from 'lodash/size';
import lodashEach from 'lodash/each';
import googleAnalytics from '../components/util/google-analytics';
-import olExtent from 'ol/extent';
+import * as olExtent from 'ol/extent';
import { dataMap } from './map';
import uiIndicator from '../ui/indicator';
diff --git a/web/js/image/panel.js b/web/js/image/panel.js
index 12c415dfa..c586743cc 100644
--- a/web/js/image/panel.js
+++ b/web/js/image/panel.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import 'jquery-ui-bundle/jquery-ui';
-import olProj from 'ol/proj';
+import * as olProj from 'ol/proj';
import ImageResSelection from '../components/image-panel/select';
import googleAnalytics from '../components/util/google-analytics';
import util from '../util/util';
diff --git a/web/js/map/animate.js b/web/js/map/animate.js
index 664b16840..284576299 100644
--- a/web/js/map/animate.js
+++ b/web/js/map/animate.js
@@ -1,5 +1,6 @@
-import olExtent from 'ol/extent';
+import * as olExtent from 'ol/extent';
import OlGeomLineString from 'ol/geom/LineString';
+
export function mapAnimate(models, config, ui) {
var self = {};
diff --git a/web/js/map/model.js b/web/js/map/model.js
index 65ea76269..c2f05ecc2 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -1,6 +1,6 @@
import util from '../util/util';
import lodashClone from 'lodash/clone';
-import olExtent from 'ol/extent';
+import { intersects } from 'ol/extent';
export function mapModel(models, config) {
var self = {};
@@ -44,7 +44,7 @@ export function mapModel(models, config) {
if (proj.id === 'geographic') {
proj.wrapExtent = maxExtent = [-250, -90, 250, 90];
}
- if (olExtent.intersects(extent, maxExtent)) {
+ if (intersects(extent, maxExtent)) {
self.extent = state.v;
} else {
self.extent = lodashClone(proj.maxExtent);
diff --git a/web/js/map/precachetile.js b/web/js/map/precachetile.js
index ba3d80736..ccf012085 100644
--- a/web/js/map/precachetile.js
+++ b/web/js/map/precachetile.js
@@ -1,5 +1,5 @@
import lodashEach from 'lodash/each';
-import olExtent from 'ol/extent';
+import * as olExtent from 'ol/extent';
import OlRendererCanvasTileLayer from 'ol/renderer/canvas/TileLayer';
export function mapPrecacheTile(models, config, cache, parent) {
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 3d1e47628..8d8d3e019 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -13,7 +13,7 @@ import OlKinetic from 'ol/Kinetic';
import OlGraticule from 'ol/Graticule';
import OlStyleStroke from 'ol/style/Stroke';
import OlControlScaleLine from 'ol/control/ScaleLine';
-import olEventsCondition from 'ol/events/condition';
+import { altKeyOnly } from 'ol/events/condition';
import OlInteractionPinchRotate from 'ol/interaction/PinchRotate';
import OlInteractionDragRotate from 'ol/interaction/DragRotate';
import OlInteractionDoubleClickZoom from 'ol/interaction/DoubleClickZoom';
@@ -22,8 +22,8 @@ import OlInteractionDragPan from 'ol/interaction/DragPan';
import OlInteractionMouseWheelZoom from 'ol/interaction/MouseWheelZoom';
import OlInteractionDragZoom from 'ol/interaction/DragZoom';
import OlLayerGroup from 'ol/layer/Group';
-import olExtent from 'ol/extent';
-import olProj from 'ol/proj';
+import * as olExtent from 'ol/extent';
+import * as olProj from 'ol/proj';
import { MapRotate } from './rotation';
import { mapDateLineBuilder } from './datelinebuilder';
import { mapLayerBuilder } from './layerbuilder';
@@ -743,7 +743,7 @@ export function mapui(models, config) {
});
rotateInteraction = new OlInteractionDragRotate({
- condition: olEventsCondition.altKeyOnly,
+ condition: altKeyOnly,
duration: animationDuration
});
mobileRotation = new OlInteractionPinchRotate({
diff --git a/web/js/natural-events/markers.js b/web/js/natural-events/markers.js
index d9ff02b22..e3ebbe374 100644
--- a/web/js/natural-events/markers.js
+++ b/web/js/natural-events/markers.js
@@ -1,6 +1,6 @@
import lodashFind from 'lodash/find';
import lodashIsEmpty from 'lodash/isEmpty';
-import olExtent from 'ol/extent';
+import * as olExtent from 'ol/extent';
import OlOverlay from 'ol/Overlay';
import OlFeature from 'ol/Feature';
import OlStyleStyle from 'ol/style/Style';
@@ -8,7 +8,7 @@ import OlStyleStroke from 'ol/style/Stroke';
import OlLayerVector from 'ol/layer/Vector';
import OlSourceVector from 'ol/source/Vector';
import OlGeomPolygon from 'ol/geom/Polygon';
-import olProj from 'ol/proj';
+import * as olProj from 'ol/proj';
export default function markers (models, ui) {
var self = {};
diff --git a/web/js/natural-events/ui.js b/web/js/natural-events/ui.js
index f35977fdd..181fd9ccc 100644
--- a/web/js/natural-events/ui.js
+++ b/web/js/natural-events/ui.js
@@ -1,7 +1,7 @@
import lodashFind from 'lodash/find';
import lodashEach from 'lodash/each';
-import olExtent from 'ol/extent';
-import olProj from 'ol/proj';
+import * as olExtent from 'ol/extent';
+import * as olProj from 'ol/proj';
import markers from './markers';
import track from './track';
diff --git a/web/js/projection/model.js b/web/js/projection/model.js
index b4bab1f13..d4f51c6af 100644
--- a/web/js/projection/model.js
+++ b/web/js/projection/model.js
@@ -1,5 +1,4 @@
-import lodashEach from 'lodash/each';
-import olProj from 'ol/proj';
+import * as olProj from 'ol/proj';
import { register } from 'ol/proj/proj4';
import proj4 from 'proj4';
import util from '../util/util';
@@ -11,13 +10,9 @@ export function projectionModel(config) {
var init = function () {
self.selectDefault();
- // olProj.setProj4(proj4);
- register(proj4);
- lodashEach(config.projections, function (proj) {
+ Object.values(config.projections).forEach((proj) => {
if (proj.crs && proj.proj4) {
self.register(proj.crs, proj.proj4);
- olProj.get(proj.crs)
- .setExtent(proj.maxExtent);
}
});
};
@@ -55,6 +50,8 @@ export function projectionModel(config) {
self.register = function (crs, def) {
if (def && proj4) {
proj4.defs(crs, def);
+ register(proj4);
+ olProj.get(crs).setExtent(def.maxExtent);
}
};