Skip to content

Commit

Permalink
[feat] allow to open COG links in external viewer (#7387)
Browse files Browse the repository at this point in the history
* add OGC:COG to possible values for gmd:protocol

* add support to open OGC:COG links in the external viewer

* show an alert saying COG/3DTiles is not supported yet

This will also avoid switching to the viewer if no layer with supported
protocol is found

---------

Co-authored-by: Olivia <[email protected]>
  • Loading branch information
landryb and jahow committed Jan 16, 2024
1 parent 14453f1 commit ee5ea44
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3933,6 +3933,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web
</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6358,6 +6358,7 @@ la non-évaluation</b>, dans le cadre de métadonnées INSPIRE
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2193,6 +2193,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option show="-" value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option show="-" value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option show="-" value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Servei de catàleg per a la Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option value="OGC:GML">OGC-GML Llenguatge de Marcat Geogràfic</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2189,6 +2189,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option show="-" value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option show="-" value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option show="-" value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option show="-" value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option show="-" value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option show="-" value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2274,6 +2274,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2158,6 +2158,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web
</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4357,6 +4357,7 @@ la non-évaluation</b>, dans le cadre de métadonnées INSPIRE
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:WMS-http-get-map">OGC-WMS Web Map Service</option>
<option value="OGC:WFS-http-get-capabilities">OGC-WFS Web Feature Service</option>
<option value="OGC:WCS-http-get-capabilities">OGC-WCS Web Coverage Service</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2041,6 +2041,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option show="-" value="OGC:CSW">OGC-CSW Catalogue Service for the Web
</option>
<option show="-" value="OGC:KML">OGC-KML Keyhole Markup Language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1973,6 +1973,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option show="-" value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option show="-" value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option show="-" value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option show="-" value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option show="-" value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option show="-" value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option show="-" value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option show="-" value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option show="-" value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,7 @@ presnosť / vertikálna -</option>
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1945,6 +1945,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Servicio de catálogo para la Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option value="OGC:GML">OGC-GML Lenguaje de Marcado Geográfico</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,7 @@
<option value="OGC API - Maps">OGC API - Maps</option>
<option value="OGC API - Records">OGC API - Records</option>
<option value="OGC:3DTILES">OGC-3DTiles Dataset</option>
<option value="OGC:COG">OGC-Cloud Optimized GeoTIFF</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
<option value="OGC:GML">OGC-GML Geography Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
return r.mimeType;
} else if (r.protocol && r.protocol.indexOf("WWW:DOWNLOAD:") >= 0) {
return r.protocol.replace("WWW:DOWNLOAD:", "");
} else if (mainType.match(/W([MCF]|MT)S.*|3DTILES|ESRI:REST/) != null) {
} else if (mainType.match(/W([MCF]|MT)S.*|3DTILES|COG|ESRI:REST/) != null) {
return mainType.replace("SERVICE", "");
} else if (mainType.match(/KML|GPX/) != null) {
return mainType;
Expand Down Expand Up @@ -128,6 +128,8 @@
gnViewerSettings.resultviewFns && gnViewerSettings.resultviewFns.addMdLayerToMap;
var add3dTilesToMap =
gnViewerSettings.resultviewFns && gnViewerSettings.resultviewFns.addMdLayerToMap;
var addCogeoToMap =
gnViewerSettings.resultviewFns && gnViewerSettings.resultviewFns.addMdLayerToMap;
var addEsriRestToMap =
gnViewerSettings.resultviewFns && gnViewerSettings.resultviewFns.addMdLayerToMap;

Expand Down Expand Up @@ -286,6 +288,11 @@
label: "addToMap",
action: add3dTilesToMap
},
COG: {
iconClass: "fa-globe",
label: "addToMap",
action: addCogeoToMap
},
TMS: {
iconClass: "fa-globe",
label: "addToMap",
Expand Down Expand Up @@ -517,6 +524,8 @@
return "WMTS";
} else if (protocolOrType.match(/3dtiles/i)) {
return "3DTILES";
} else if (protocolOrType.match(/cog/i)) {
return "COG";
} else if (protocolOrType.match(/tms/i)) {
return "TMS";
} else if (protocolOrType.match(/wfs/i)) {
Expand Down
1 change: 1 addition & 0 deletions web-ui/src/main/resources/catalog/js/CatController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@
layers: [
"OGC:WMS",
"OGC:3DTILES",
"OGC:COG",
"OGC:WMTS",
"OGC:WMS-1.1.1-http-get-map",
"OGC:WMS-1.3.0-http-get-map",
Expand Down
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 @@ -378,6 +378,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
2 changes: 2 additions & 0 deletions web-ui/src/main/resources/catalog/style/gn_icons.less
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@
.gn-icontype-wps,
.gn-icontype-wcs,
.gn-icontype-atom,
.gn-icontype-3dtiles,
.gn-icontype-cog,
.gn-icontype-esri-rest,
.gn-icontype-wfs {
background-color: @btn-success-bg !important;
Expand Down
62 changes: 46 additions & 16 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,16 +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"
: "wms",
type,
url: $filter("gnLocalized")(link.url) || link.url
};

Expand Down Expand Up @@ -412,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 ee5ea44

Please sign in to comment.