Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-4142 - Disable wrapX on AERONET vector source (#6922)

vicgonzalez25a5d10a8fde55
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index b7ca7f866..e7af9c08d 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -648,6 +648,10 @@ export default function mapLayerBuilder(config, cache, store) {
const vectorSource = new OlSourceVector({
format: new GeoJSON(),
+ // Only render a single world. OpenLayers does not apply the layer extent
+ // clip to the canvas it draws on when opacity is less than 1, which would
+ // otherwise leave adjacent world copies visible outside of layerExtent
+ wrapX: false,
loader: async () => {
const allDataKey = `AERONET:${date.getUTCFullYear()}`;
diff --git a/web/js/map/layerbuilder.test.js b/web/js/map/layerbuilder.test.js
index 66d9ef251..c55e2c8be 100644
--- a/web/js/map/layerbuilder.test.js
+++ b/web/js/map/layerbuilder.test.js
@@ -579,6 +579,22 @@ describe('mapLayerBuilder', () => {
expect(layer).toBeDefined();
});
+ it('disables wrapX on the AERONET source so points stay within the layer extent', async () => {
+ const OlSourceVector = require('ol/source/Vector');
+ builder = mapLayerBuilder(
+ buildConfig({ AERONET: { url: 'https://aeronet.example.com', matrixSets: {} } }),
+ cache,
+ store,
+ );
+ await builder.createLayer(
+ buildDef({ type: 'vector', source: 'AERONET', projections: { geographic: {} } }),
+ buildOptions(),
+ );
+ expect(OlSourceVector).toHaveBeenCalledWith(
+ expect.objectContaining({ wrapX: false }),
+ );
+ });
+
it('throws error for AERONET with missing source config', async () => {
const noAeronetConfig = buildConfig();
delete noAeronetConfig.sources.AERONET;