• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geosolutions-it / MapStore2 / 6942739048

21 Nov 2023 10:52AM UTC coverage: 78.299% (-0.02%) from 78.32%
6942739048

push

github

web-flow
#9589: Notify data projection not compatible / available for COG (#9690) (#9717)

(cherry picked from commit 76207ab45)

28757 of 43735 branches covered (0.0%)

19 of 21 new or added lines in 3 files covered. (90.48%)

11 existing lines in 4 files now uncovered.

36016 of 45998 relevant lines covered (78.3%)

42.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

10.0
/web/client/components/map/openlayers/plugins/COGLayer.js
1
/**
2
 * Copyright 2015, GeoSolutions Sas.
3
 * All rights reserved.
4
 *
5
 * This source code is licensed under the BSD-style license found in the
6
 * LICENSE file in the root directory of this source tree.
7
 */
8

9
import Layers from '../../../../utils/openlayers/Layers';
10

11
import GeoTIFF from 'ol/source/GeoTIFF.js';
12
import TileLayer from 'ol/layer/WebGLTile.js';
13
import { isProjectionAvailable } from '../../../../utils/ProjectionUtils';
14

15
function create(options) {
16
    return new TileLayer({
×
17
        msId: options.id,
18
        style: options.style, // TODO style needs to be improved. Currently renders only predefined band and ranges when specified in config
19
        opacity: options.opacity !== undefined ? options.opacity : 1,
×
20
        visible: options.visibility,
21
        source: new GeoTIFF({
22
            convertToRGB: 'auto', // CMYK, YCbCr, CIELab, and ICCLab images will automatically be converted to RGB
23
            sources: options.sources,
24
            wrapX: true
25
        }),
26
        zIndex: options.zIndex,
27
        minResolution: options.minResolution,
28
        maxResolution: options.maxResolution
29
    });
30
}
31

32
Layers.registerType('cog', {
1✔
33
    create,
34
    update(layer, newOptions, oldOptions, map) {
35
        if (newOptions.srs !== oldOptions.srs) {
×
36
            return create(newOptions, map);
×
37
        }
38
        if (oldOptions.minResolution !== newOptions.minResolution) {
×
39
            layer.setMinResolution(newOptions.minResolution === undefined ? 0 : newOptions.minResolution);
×
40
        }
41
        if (oldOptions.maxResolution !== newOptions.maxResolution) {
×
42
            layer.setMaxResolution(newOptions.maxResolution === undefined ? Infinity : newOptions.maxResolution);
×
43
        }
44
        return null;
×
45
    },
46
    isCompatible: (layer) => {
NEW
47
        return isProjectionAvailable(layer?.sourceMetadata?.crs);
×
48
    }
49
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc