Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

migrate to ol6

Benjamin King4b16fa3842cf
diff --git a/package-lock.json b/package-lock.json
index 3a2394581..445417158 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4064,9 +4064,9 @@
"integrity": "sha1-zlblOfg1UrWNENZy6k1vya3HsjQ="
},
"@mapbox/mapbox-gl-style-spec": {
- "version": "13.14.0",
- "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-style-spec/-/mapbox-gl-style-spec-13.14.0.tgz",
- "integrity": "sha512-Kh57agTpI0Q1QISAWjh22LLdIBNEmY+v+8jeWA5ZCrY+nCPuW8eCdd3UTMuvduqoX8G50V0hiMVHkMAUZkagDA==",
+ "version": "13.16.0",
+ "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-style-spec/-/mapbox-gl-style-spec-13.16.0.tgz",
+ "integrity": "sha512-HtQCLg8NLgnYI0uOSbMNtTcwiCJc9WR5uZekhFaXbyjUWwZVNMW7ElKrDLYkaZ4lvUvbqjotyvZC2Holn/yhpg==",
"requires": {
"@mapbox/jsonlint-lines-primitives": "~2.0.2",
"@mapbox/point-geometry": "^0.1.0",
@@ -4076,13 +4076,6 @@
"minimist": "^1.2.5",
"rw": "^1.3.3",
"sort-object": "^0.3.2"
- },
- "dependencies": {
- "minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
- }
}
},
"@mapbox/point-geometry": {
@@ -15761,8 +15754,7 @@
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
- "dev": true
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"minimist-options": {
"version": "4.0.2",
@@ -17070,37 +17062,22 @@
"dev": true
},
"ol": {
- "version": "5.3.3",
- "resolved": "https://registry.npmjs.org/ol/-/ol-5.3.3.tgz",
- "integrity": "sha512-7eU4x8YMduNcED1D5wI+AMWDRe7/1HmGfsbV+kFFROI9RNABU/6n4osj6Q3trZbxxKnK2DSRIjIRGwRHT/Z+Ww==",
+ "version": "6.4.3",
+ "resolved": "https://registry.npmjs.org/ol/-/ol-6.4.3.tgz",
+ "integrity": "sha512-JcoZ/VJE9cUoxfhpa2EFYH0AHFYty1x47aITsQgLkyvWIWWigWp1N9LBcCSlCuu2QkE+DutomI2oKfnFbQA/xw==",
"requires": {
- "pbf": "3.1.0",
- "pixelworks": "1.1.0",
- "rbush": "2.0.2"
- },
- "dependencies": {
- "quickselect": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.1.1.tgz",
- "integrity": "sha512-qN0Gqdw4c4KGPsBOQafj6yj/PA6c/L63f6CaZ/DCF/xF4Esu3jVmKLUDYxghFx8Kb/O7y9tI7x2RjTSXwdK1iQ=="
- },
- "rbush": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/rbush/-/rbush-2.0.2.tgz",
- "integrity": "sha512-XBOuALcTm+O/H8G90b6pzu6nX6v2zCKiFG4BJho8a+bY6AER6t8uQUZdi5bomQc0AprCWhEGa7ncAbbRap0bRA==",
- "requires": {
- "quickselect": "^1.0.1"
- }
- }
+ "ol-mapbox-style": "^6.1.1",
+ "pbf": "3.2.1",
+ "rbush": "^3.0.1"
}
},
"ol-mapbox-style": {
- "version": "4.3.1",
- "resolved": "https://registry.npmjs.org/ol-mapbox-style/-/ol-mapbox-style-4.3.1.tgz",
- "integrity": "sha512-b3p4lvmEAxyoid3WklQJVH0wfQgz8QU6E0c15Avbybt/3oL0LtZ76+TdHxq29GomFXWK3ywn+4PscPm4o+edRw==",
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/ol-mapbox-style/-/ol-mapbox-style-6.1.2.tgz",
+ "integrity": "sha512-0n+6K1dhMH7/AMA1eAEb1Pt4ZRFWr1fiJWSgwHfDFQpK4yuhJgtLcn9dtxprB1NOpTHeJ5XbTKOrgTY/DR0oxQ==",
"requires": {
- "@mapbox/mapbox-gl-style-spec": "^13.6.0",
- "mapbox-to-css-font": "^2.3.0",
+ "@mapbox/mapbox-gl-style-spec": "^13.14.0",
+ "mapbox-to-css-font": "^2.4.0",
"webfont-matcher": "^1.1.0"
}
},
@@ -17712,12 +17689,12 @@
}
},
"pbf": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.1.0.tgz",
- "integrity": "sha512-/hYJmIsTmh7fMkHAWWXJ5b8IKLWdjdlAFb3IHkRBn1XUhIYBChVGfVwmHEAV3UfXTxsP/AKfYTXTS/dCPxJd5w==",
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz",
+ "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==",
"requires": {
- "ieee754": "^1.1.6",
- "resolve-protobuf-schema": "^2.0.0"
+ "ieee754": "^1.1.12",
+ "resolve-protobuf-schema": "^2.1.0"
}
},
"pbkdf2": {
@@ -17786,11 +17763,6 @@
"node-modules-regexp": "^1.0.0"
}
},
- "pixelworks": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/pixelworks/-/pixelworks-1.1.0.tgz",
- "integrity": "sha1-Hwla1I3Ki/ihyCWOAJIDGkTyLKU="
- },
"pkg-dir": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz",
@@ -19653,9 +19625,9 @@
}
},
"protocol-buffers-schema": {
- "version": "3.3.2",
- "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.3.2.tgz",
- "integrity": "sha512-Xdayp8sB/mU+sUV4G7ws8xtYMGdQnxbeIfLjyO9TZZRJdztBGhlmbI5x1qcY4TG5hBkIKGnc28i7nXxaugu88w=="
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.4.0.tgz",
+ "integrity": "sha512-G/2kcamPF2S49W5yaMGdIpkG6+5wZF0fzBteLKgEHjbNzqjZQ85aAs1iJGto31EJaSTkNvHs5IXuHSaTLWBAiA=="
},
"proxy-addr": {
"version": "2.0.5",
@@ -19837,6 +19809,11 @@
"integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==",
"dev": true
},
+ "quickselect": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz",
+ "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw=="
+ },
"raf": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
@@ -19887,6 +19864,14 @@
"unpipe": "1.0.0"
}
},
+ "rbush": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz",
+ "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==",
+ "requires": {
+ "quickselect": "^2.0.0"
+ }
+ },
"rc-pagination": {
"version": "1.21.0",
"resolved": "https://registry.npmjs.org/rc-pagination/-/rc-pagination-1.21.0.tgz",
diff --git a/package.json b/package.json
index a9958e054..91ea94ef6 100644
--- a/package.json
+++ b/package.json
@@ -189,8 +189,8 @@
"lodash": "^4.17.19",
"moment": "^2.19.3",
"moment-locales-webpack-plugin": "^1.1.2",
- "ol": "5.3.3",
- "ol-mapbox-style": "4.3.1",
+ "ol": "6.4.x",
+ "ol-mapbox-style": "6.1.x",
"proj4": "2.6.1",
"promise-queue": "2.2.5",
"prop-types": "^15.7.2",
diff --git a/web/js/map/compare/spy.js b/web/js/map/compare/spy.js
index 186202d74..ed82df9b3 100644
--- a/web/js/map/compare/spy.js
+++ b/web/js/map/compare/spy.js
@@ -1,4 +1,5 @@
-import lodashEach from 'lodash/each';
+import { each as lodashEach } from 'lodash';
+import { getRenderPixel } from 'ol/render';
let mousePosition = null;
let spy = null;
@@ -116,7 +117,8 @@ export default class Spy {
* @param {Object} layer | Ol Layer object
*/
const applyReverseLayerListeners = function(layer) {
- layer.on('postcompose', inverseClip);
+ layer.on('postrender', inverseClip);
+ layer.on('postrender', restore);
bottomLayers.push(layer);
};
/**
@@ -124,8 +126,8 @@ const applyReverseLayerListeners = function(layer) {
* @param {Object} layer | Ol Layer object
*/
const applyLayerListeners = function(layer) {
- layer.on('precompose', clip);
- layer.on('postcompose', restore);
+ layer.on('prerender', clip);
+ layer.on('postrender', restore);
topLayers.push(layer);
};
/**
@@ -134,22 +136,19 @@ const applyLayerListeners = function(layer) {
*/
const inverseClip = function(event) {
const ctx = event.context;
- const { pixelRatio } = event.frameState;
ctx.save();
ctx.beginPath();
if (mousePosition) {
// only show a circle around the mouse
- const x = mousePosition[0];
- const y = mousePosition[1];
- ctx.arc(
- x * pixelRatio,
- y * pixelRatio,
- radius * pixelRatio,
- 0,
- 2 * Math.PI,
- );
- ctx.rect(ctx.canvas.width, ctx.canvas.height, -ctx.canvas.width, 0);
- ctx.fill();
+ const pixel = getRenderPixel(event, mousePosition);
+ const offset = getRenderPixel(event, [mousePosition[0] + radius, mousePosition[1]]);
+ const canvasRadius = Math.sqrt(((offset[0] - pixel[0]) ** 2) + ((offset[1] - pixel[1]) ** 2));
+ ctx.arc(pixel[0], pixel[1], canvasRadius, 0, 2 * Math.PI);
+ ctx.closePath();
+ ctx.lineWidth = (5 * canvasRadius) / radius;
+ ctx.strokeStyle = 'rgba(0,0,0,0.5)';
+ ctx.clip();
+ ctx.clearRect(0, 0, offset, offset);
}
};
/**
@@ -157,19 +156,16 @@ const inverseClip = function(event) {
*/
const clip = function(event) {
const ctx = event.context;
- const { pixelRatio } = event.frameState;
ctx.save();
ctx.beginPath();
if (mousePosition) {
// only show a circle around the mouse
- const x = mousePosition[0];
- const y = mousePosition[1];
- const pixelRadius = radius * pixelRatio;
-
- ctx.arc(x * pixelRatio, y * pixelRatio, pixelRadius, 0, 2 * Math.PI);
-
- ctx.lineWidth = 4 * pixelRatio;
- ctx.strokeStyle = 'rgba(0,0,0,0.4)';
+ const pixel = getRenderPixel(event, mousePosition);
+ const offset = getRenderPixel(event, [mousePosition[0] + radius, mousePosition[1]]);
+ const canvasRadius = Math.sqrt(((offset[0] - pixel[0]) ** 2) + ((offset[1] - pixel[1]) ** 2));
+ ctx.arc(pixel[0], pixel[1], canvasRadius, 0, 2 * Math.PI);
+ ctx.lineWidth = (5 * canvasRadius) / radius;
+ ctx.strokeStyle = 'rgba(0,0,0,0.5)';
ctx.stroke();
}
ctx.clip();
@@ -184,8 +180,8 @@ const restore = function(event) {
*/
const removeListenersFromLayers = function(layers) {
lodashEach(layers, (layer) => {
- layer.un('precompose', clip);
- layer.un('postcompose', restore);
+ layer.un('prerender', clip);
+ layer.un('postrender', restore);
});
};
/**
@@ -194,8 +190,8 @@ const removeListenersFromLayers = function(layers) {
*/
const removeInverseListenersFromLayers = function(layers) {
lodashEach(layers, (layer) => {
- layer.un('precompose', inverseClip);
- layer.un('postcompose', restore);
+ layer.un('prerender', inverseClip);
+ layer.un('postrender', restore);
});
};
/**
diff --git a/web/js/map/compare/swipe.js b/web/js/map/compare/swipe.js
index b095357f6..1de53ebd9 100644
--- a/web/js/map/compare/swipe.js
+++ b/web/js/map/compare/swipe.js
@@ -114,8 +114,8 @@ export default class Swipe {
*/
removeListenersFromBottomLayers(layers) {
lodashEach(layers, (layer) => {
- layer.un('precompose', this.reverseClip);
- layer.un('postcompose', restore);
+ layer.un('prerender', this.reverseClip);
+ layer.un('postrender', restore);
});
}
@@ -125,8 +125,8 @@ export default class Swipe {
*/
removeListenersFromLayers(layers) {
lodashEach(layers, (layer) => {
- layer.un('precompose', this.clip);
- layer.un('postcompose', restore);
+ layer.un('prerender', this.clip);
+ layer.un('postrender', restore);
});
}
}
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index 807a40d37..513a95d4e 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -5,6 +5,8 @@ import OlSourceTileWMS from 'ol/source/TileWMS';
import OlLayerGroup from 'ol/layer/Group';
import OlLayerTile from 'ol/layer/Tile';
import OlTileGridTileGrid from 'ol/tilegrid/TileGrid';
+import OlStroke from 'ol/style/Stroke';
+import OlGraticule from 'ol/layer/Graticule';
import MVT from 'ol/format/MVT';
import LayerVectorTile from 'ol/layer/VectorTile';
import SourceVectorTile from 'ol/source/VectorTile';
@@ -130,6 +132,17 @@ export default function mapLayerBuilder(models, config, cache, ui, store) {
case 'wms':
layer = getLayer(createLayerWMS, def, options, attributes, wrapLayer);
break;
+ case 'graticule':
+ layer = new OlGraticule({
+ // the style to use for the lines, optional.
+ strokeStyle: new OlStroke({
+ color: 'rgb(255, 255, 255)',
+ width: 2,
+ lineDash: [0.5, 4],
+ }),
+ showLabels: true,
+ });
+ break;
default:
throw new Error(`Unknown layer type: ${def.type}`);
}
@@ -415,24 +428,24 @@ export default function mapLayerBuilder(models, config, cache, ui, store) {
format: new MVT(),
matrixSet: tileMatrixSet,
wrapX,
+ projection: proj.selected.crs,
tileGrid: new OlTileGridTileGrid({
extent: gridExtent,
resolutions: matrixSet.resolutions,
tileSize: matrixSet.tileSize,
origin: start,
sizes: matrixSet.tileMatrices,
-
}),
});
const layer = new LayerVectorTile({
extent: layerExtent,
source: sourceOptions,
renderMode: 'image',
+ vector: true,
preload: 10,
...isMaxBreakPoint && { maxResolution: breakPointResolution },
...isMinBreakPoint && { minResolution: breakPointResolution },
});
-
applyStyle(def, layer, state, options);
layer.wrap = day;
layer.wv = attributes;
@@ -543,6 +556,7 @@ export default function mapLayerBuilder(models, config, cache, ui, store) {
...!!resolutionBreakPoint && { minResolution: resolutionBreakPoint },
source: new OlSourceTileWMS(sourceOptions),
});
+ layer.isWMS = true;
return layer;
};
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 69914146d..9eeb23f16 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -12,8 +12,6 @@ import {
import OlMap from 'ol/Map';
import OlView from 'ol/View';
import OlKinetic from 'ol/Kinetic';
-import OlGraticule from 'ol/Graticule';
-import OlStyleStroke from 'ol/style/Stroke';
import OlControlScaleLine from 'ol/control/ScaleLine';
import { altKeyOnly } from 'ol/events/condition';
import OlInteractionPinchRotate from 'ol/interaction/PinchRotate';
@@ -346,8 +344,6 @@ export default function mapui(models, config, store, ui) {
lodashEach(activeLayers, (mapLayer) => {
map.removeLayer(mapLayer);
});
- removeGraticule('active');
- removeGraticule('activeB');
cache.clear();
};
/*
@@ -381,11 +377,7 @@ export default function mapui(models, config, store, ui) {
state,
);
lodashEach(defs, (def) => {
- if (isGraticule(def, proj.id)) {
- addGraticule(def.opacity, layerGroupStr);
- } else {
- map.addLayer(createLayer(def));
- }
+ map.addLayer(createLayer(def));
});
} else {
const stateArray = [['active', 'selected'], ['activeB', 'selectedB']];
@@ -415,13 +407,7 @@ export default function mapui(models, config, store, ui) {
{ reverse: true },
store.getState(),
)
- .filter((def) => {
- if (isGraticule(def, projId)) {
- addGraticule(def.opacity, arr[0]);
- return false;
- }
- return true;
- })
+ .filter(() => true)
.map((def) => createLayer(def, {
date: state.date[arr[1]],
group: arr[0],
@@ -446,23 +432,6 @@ export default function mapui(models, config, store, ui) {
const layersState = state.layers;
const activeGroupStr = state.compare.activeString;
const activeDateStr = state.compare.isCompareA ? 'selected' : 'selectedB';
- const updateGraticules = function(defs, groupName) {
- lodashEach(defs, (def) => {
- if (isGraticule(def, state.proj.id)) {
- renderable = isRenderableLayer(
- def.id,
- layersState[activeGroupStr],
- state.date[activeDateStr],
- state,
- );
- if (renderable) {
- addGraticule(def.opacity, groupName);
- } else {
- removeGraticule(groupName);
- }
- }
- });
- };
layers.forEach((layer) => {
const group = layer.get('group');
// Not in A|B
@@ -474,8 +443,6 @@ export default function mapui(models, config, store, ui) {
state,
);
layer.setVisible(renderable);
- const defs = getLayers(layersState[activeGroupStr], {}, state);
- updateGraticules(defs);
// If in A|B layer-group will have a 'group' string
} else if (group) {
lodashEach(layer.getLayers().getArray(), (subLayer) => {
@@ -490,8 +457,6 @@ export default function mapui(models, config, store, ui) {
}
});
layer.setVisible(true);
- const defs = getLayers(layersState[group], {}, state);
- updateGraticules(defs, group);
}
});
}
@@ -509,21 +474,15 @@ export default function mapui(models, config, store, ui) {
*/
function updateOpacity(action) {
const state = store.getState();
- const { layers, compare, proj } = state;
+ const { layers, compare } = state;
const activeStr = compare.isCompareA ? 'active' : 'activeB';
const def = lodashFind(layers[activeStr], {
id: action.id,
});
+ const layer = findLayer(def, activeStr);
- if (isGraticule(def, proj.id)) {
- const strokeStyle = self[`graticule-${activeStr}-style`];
- strokeStyle.setColor(`rgba(255, 255, 255,${action.opacity})`);
- self.selected.render();
- } else {
- const layer = findLayer(def, activeStr);
- layer.setOpacity(action.opacity);
- updateLayerVisibilities();
- }
+ layer.setOpacity(action.opacity);
+ updateLayerVisibilities();
}
/*
*Initiates the adding of a layer or Graticule
@@ -538,7 +497,7 @@ export default function mapui(models, config, store, ui) {
function addLayer(def, date, activeLayers) {
const state = store.getState();
- const { compare, layers, proj } = state;
+ const { compare, layers } = state;
const activeDateStr = compare.isCompareA ? 'selected' : 'selectedB';
const activeLayerStr = compare.isCompareA ? 'active' : 'activeB';
date = date || state.date[activeDateStr];
@@ -549,9 +508,7 @@ export default function mapui(models, config, store, ui) {
});
const mapLayers = self.selected.getLayers().getArray();
const firstLayer = mapLayers[0];
- if (isGraticule(def, proj.id)) {
- addGraticule(def.opacity, activeLayerStr);
- } else if (firstLayer && firstLayer.get('group')) {
+ if (firstLayer && firstLayer.get('group')) {
// Find which map layer-group is the active LayerGroup
// and add layer to layerGroup in correct location
const activelayer = firstLayer.get('group') === activeLayerStr
@@ -582,21 +539,18 @@ export default function mapui(models, config, store, ui) {
*/
function removeLayer(action) {
const state = store.getState();
- const { compare, proj } = state;
+ const { compare } = state;
const activeLayerStr = compare.isCompareA ? 'active' : 'activeB';
const { def } = action;
- if (isGraticule(def, proj.id)) {
- removeGraticule(activeLayerStr);
+ const layer = findLayer(def, activeLayerStr);
+ if (compare && compare.active) {
+ const layerGroup = getActiveLayerGroup(self.selected, activeLayerStr);
+ if (layerGroup) layerGroup.getLayers().remove(layer);
} else {
- const layer = findLayer(def, activeLayerStr);
- if (compare && compare.active) {
- const layerGroup = getActiveLayerGroup(self.selected, activeLayerStr);
- if (layerGroup) layerGroup.getLayers().remove(layer);
- } else {
- self.selected.removeLayer(layer);
- }
+ self.selected.removeLayer(layer);
}
+
updateLayerVisibilities();
}
@@ -751,77 +705,6 @@ export default function mapui(models, config, store, ui) {
return index;
}
- /*
- * Checks a layer's properties to deterimine if
- * it is a graticule
- *
- *
- * @method isGraticule
- * @static
- *
- * @param def {object} Layer Specs
- *
- *
- * @returns {boolean}
- */
- function isGraticule(def, proj) {
- return (
- def.projections[proj].type === 'graticule' || def.type === 'graticule'
- );
- }
-
- /*
- * Adds a graticule to the OpenLayers Map
- * if a graticule does not already exist
- *
- *
- * @method addGraticule
- * @static
- *
- *
- * @returns {void}
- */
- function addGraticule(opacity, groupStr) {
- groupStr = groupStr || 'active';
- opacity = opacity || 0.5;
- const graticule = self.selected[`graticule-${groupStr}`];
- if (graticule) {
- return;
- }
- const strokeStyle = new OlStyleStroke({
- color: `rgba(255, 255, 255,${opacity})`,
- width: 2,
- lineDash: [0.5, 4],
- opacity,
- });
-
- self.selected[`graticule-${groupStr}`] = new OlGraticule({
- map: self.selected,
- group: groupStr,
- strokeStyle,
- });
- self[`graticule-${groupStr}-style`] = strokeStyle;
- }
-
- /*
- * Adds a graticule to the OpenLayers Map
- * if a graticule does not already exist
- *
- *
- * @method removeGraticule
- * @static
- *
- * @returns {void}
- */
- function removeGraticule(groupStr) {
- groupStr = groupStr || 'active';
- const graticule = self.selected[`graticule-${groupStr}`];
- if (graticule) {
- graticule.setMap(null);
- }
- self.selected[`graticule-${groupStr}`] = null;
- }
-
const triggerExtent = lodashThrottle(
() => {
self.events.trigger('extent');
diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.js
index 656168865..fe4549910 100644
--- a/web/js/modules/vector-styles/selectors.js
+++ b/web/js/modules/vector-styles/selectors.js
@@ -7,7 +7,7 @@ import {
import update from 'immutability-helper';
import { containsCoordinate } from 'ol/extent';
-import stylefunction from 'ol-mapbox-style/stylefunction';
+import stylefunction from 'ol-mapbox-style/dist/stylefunction';
import { getMinValue, getMaxValue, selectedStyleFunction } from './util';
import {
getLayers,
@@ -127,7 +127,7 @@ export function setStyleFunction(def, vectorStyleId, vectorStyles, layer, state)
}
const layerArray = layer.getLayers ? layer.getLayers().getArray() : [layer];
lodashEach(layerArray, (layerInLayerGroup) => {
- if (layerInLayerGroup.type === 'TILE') return; // WMS breakpoint tile
+ if (layerInLayerGroup.isWMS) return; // WMS breakpoint tile
layerInLayerGroup = layerInLayerGroup.getLayers ? lodashFind(layerInLayerGroup.getLayers().getArray(), 'isVector') : layerInLayerGroup;
// Apply mapbox-gl styles
const extentStartX = layerInLayerGroup.getExtent()[0];