Skip to content

Commit

Permalink
show an alert saying COG/3DTiles is not supported yet
Browse files Browse the repository at this point in the history
This will also avoid switching to the viewer if no layer with supported
protocol is found
  • Loading branch information
jahow committed Oct 6, 2023
1 parent 4f36afa commit 98fd3c3
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 18 deletions.
1 change: 1 addition & 0 deletions web-ui/src/main/resources/catalog/locales/en-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
"layerNotAvailableInMapProj": "The service does not provide the layer in the map projection '{{proj}}'. The layer will be added to the map but may not be displayed properly.",
"layerCRSNotFound": "The layer does not provide coordinate reference system information. This may be related to a WMS version lower than 1.3.0.",
"layerTileLoadError": "Something went wrong while loading tile <a href='{{url}}' target='_blank'>'{{url | limitTo: 30}} ...'</a> for layer '{{layer}}'.",
"layerProtocolNotSupported": "The following protocol is not supported yet in the map viewer: {{type}}",
"getCapFailure":"The WMS getCapabilities request failed",
"standards": "Metadata standard",
"documentStandard": "Metadata standard",
Expand Down
64 changes: 46 additions & 18 deletions web-ui/src/main/resources/catalog/views/default/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"gnFacetSorter",
"gnExternalViewer",
"gnUrlUtils",
"gnAlertService",
function (
$scope,
$location,
Expand All @@ -191,7 +192,8 @@
gnESFacet,
gnFacetSorter,
gnExternalViewer,
gnUrlUtils
gnUrlUtils,
gnAlertService
) {
var viewerMap = gnSearchSettings.viewerMap;
var searchMap = gnSearchSettings.searchMap;
Expand Down Expand Up @@ -353,18 +355,23 @@
});

function buildAddToMapConfig(link, md) {
var type = "wms";
if (link.protocol.indexOf("WMTS") > -1) {
type = "wmts";
} else if (
link.protocol === "ESRI:REST" ||
link.protocol.startsWith("ESRI REST")
) {
type = "esrirest";
} else if (link.protocol === "OGC:3DTILES") {
type = "3dtiles";
} else if (link.protocol === "OGC:COG") {
type = "cog";
}

var config = {
uuid: md ? md.uuid : null,
type:
link.protocol.indexOf("WMTS") > -1
? "wmts"
: link.protocol == "ESRI:REST" || link.protocol.startsWith("ESRI REST")
? "esrirest"
: link.protocol == "OGC:3DTILES"
? "3dtiles"
: link.protocol == "OGC:COG"
? "cog"
: "wms",
type,
url: $filter("gnLocalized")(link.url) || link.url
};

Expand Down Expand Up @@ -414,27 +421,48 @@
);
return;
}

// no support for COG or 3DTiles for now
if (config.type === "cog" || config.type === "3dtiles") {
gnAlertService.addAlert({
msg: $translate.instant("layerProtocolNotSupported", {
type: link.protocol
}),
delay: 20000,
type: "warning"
});
return;
}

return config;
}

$scope.resultviewFns = {
addMdLayerToMap: function (link, md) {
// This is probably only a service
// Open the add service layer tab
var config = buildAddToMapConfig(link, md);
if (!config) {
return;
}
$location.path("map").search({
add: encodeURIComponent(angular.toJson([buildAddToMapConfig(link, md)]))
add: encodeURIComponent(angular.toJson([config]))
});
return;
},
addAllMdLayersToMap: function (layers, md) {
var config = [];
angular.forEach(layers, function (layer) {
config.push(buildAddToMapConfig(layer, md));
});
var config = layers
.map(function (layer) {
return buildAddToMapConfig(layer, md);
})
.filter(function (config) {
return !!config;
});
if (config.length === 0) {
return;
}
$location.path("map").search({
add: encodeURIComponent(angular.toJson(config))
});
return;
},
loadMap: function (map, md) {
gnOwsContextService.loadContextFromUrl(map.url, viewerMap);
Expand Down

0 comments on commit 98fd3c3

Please sign in to comment.