Skip to content

Commit

Permalink
Harvester / OGC WxS / Add WMTS basic support (#4829)
Browse files Browse the repository at this point in the history
* Harvester / OGC WxS / Add WMTS basic support

Create service and dataset metadata based on Capabilities information.

Also
* Fix missing gco:CharacterString on protocol
* Improve options in configuration panel (template selection only when supported, thumbnail option only when supported).

* Harvester / OGC WxS / Fix add to map.
  • Loading branch information
fxprunayre authored Aug 19, 2020
1 parent 88d4f43 commit 5706648
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,15 @@ private List<String> addMetadata(Element capa) throws Exception {
// and add the metadata
XPath xp = XPath.newInstance("//Layer[count(./*[name(.)='Layer'])=0] | " +
"//wms:Layer[count(./*[name(.)='Layer'])=0] | " +
"//wmts:Layer[count(./*[local-name(.)='Layer'])=0] | " +
"//wfs:FeatureType | " +
"//wcs:CoverageOfferingBrief | " +
"//sos:ObservationOffering | " +
"//wps:ProcessSummary");
xp.addNamespace("wfs", "http://www.opengis.net/wfs");
xp.addNamespace("wcs", "http://www.opengis.net/wcs");
xp.addNamespace("wms", "http://www.opengis.net/wms");
xp.addNamespace("wmts", "http://www.opengis.net/wmts/1.0");
xp.addNamespace("wps", "http://www.opengis.net/wps/2.0");
xp.addNamespace("sos", "http://www.opengis.net/sos/1.0");

Expand Down Expand Up @@ -618,6 +620,9 @@ private WxSLayerRegistry addLayerMetadata(Element layer, Element capa) throws JD
} else if (params.ogctype.substring(0, 3).equals("SOS")) {
Namespace gml = Namespace.getNamespace("http://www.opengis.net/gml");
reg.name = layer.getChild("name", gml).getValue();
} else if (params.ogctype.substring(0, 4).equals("WMTS")) {
Namespace ows = Namespace.getNamespace("http://www.opengis.net/ows/1.1");
reg.name = layer.getChild("Identifier", ows).getValue();
}

//--- md5 the full capabilities URL + the layer, coverage or feature name
Expand All @@ -627,9 +632,9 @@ private WxSLayerRegistry addLayerMetadata(Element layer, Element capa) throws JD

if (params.useLayerMd && (
params.ogctype.substring(0, 3).equals("WMS") ||
params.ogctype.substring(0, 3).equals("WFS") ||
params.ogctype.substring(0, 3).equals("WPS") ||
params.ogctype.substring(0, 3).equals("WCS"))) {
params.ogctype.substring(0, 3).equals("WFS") ||
params.ogctype.substring(0, 3).equals("WPS") ||
params.ogctype.substring(0, 3).equals("WCS"))) {

log.info(" - Searching for metadataUrl for layer " + reg.name);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2016 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:include href="OGCWxSGetCapabilities-to-19119.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2016 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:include href="OGCWxSGetCapabilitiesLayer-to-19139.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Mapping between :
- WMS 1.0.0
- WMS 1.1.1
- WMS 1.3.0
- WMTS 1.0.0
- WCS 1.0.0
- WFS 1.0.0
- WFS 1.1.0
Expand All @@ -41,6 +42,7 @@ Mapping between :
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:wcs="http://www.opengis.net/wcs"
xmlns:wms="http://www.opengis.net/wms"
xmlns:wmts="http://www.opengis.net/wmts/1.0"
xmlns:ows="http://www.opengis.net/ows"
xmlns:owsg="http://www.opengeospatial.net/ows"
xmlns:ows11="http://www.opengis.net/ows/1.1"
Expand All @@ -52,59 +54,52 @@ Mapping between :
xmlns:inspire_vs="http://inspire.ec.europa.eu/schemas/inspire_vs/1.0"
version="2.0"
xmlns="http://www.isotc211.org/2005/gmd"
extension-element-prefixes="wcs ows wfs ows11 wps wps1 wps2 owsg">

<!-- ============================================================================= -->
exclude-result-prefixes="#all">

<xsl:param name="uuid">uuid</xsl:param>
<xsl:param name="lang">eng</xsl:param>
<xsl:param name="topic"></xsl:param>

<!-- ============================================================================= -->

<xsl:include href="resp-party.xsl"/>
<xsl:include href="ref-system.xsl"/>
<xsl:include href="identification.xsl"/>

<!-- ============================================================================= -->

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<!-- ============================================================================= -->


<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<!-- ============================================================================= -->

<xsl:template match="WMT_MS_Capabilities|wfs:WFS_Capabilities|wcs:WCS_Capabilities|
wps:Capabilities|wps1:Capabilities|wps2:Capabilities|wms:WMS_Capabilities">
<xsl:template match="WMT_MS_Capabilities|wfs:WFS_Capabilities|
wcs:WCS_Capabilities|
wps:Capabilities|wps1:Capabilities|wps2:Capabilities|
wms:WMS_Capabilities|wmts:Capabilities">

<xsl:variable name="ows">
<xsl:choose>
<xsl:when test="(local-name(.)='WFS_Capabilities' and namespace-uri(.)='http://www.opengis.net/wfs' and @version='1.1.0')
or (local-name(.)='Capabilities' and namespace-uri(.)='http://www.opengeospatial.net/wps')
or (local-name(.)='Capabilities' and namespace-uri(.)='http://www.opengis.net/wps/1.0.0')
or (local-name(.)='Capabilities' and namespace-uri(.)='http://www.opengis.net/wps/2.0')">true</xsl:when>
or (local-name(.)='Capabilities' and namespace-uri(.)='http://www.opengis.net/wps/2.0')
or (local-name(.)='Capabilities' and namespace-uri(.)='http://www.opengis.net/wmts/1.0')">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<MD_Metadata>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<MD_Metadata>
<fileIdentifier>
<gco:CharacterString>
<xsl:value-of select="$uuid"/>
</gco:CharacterString>
</fileIdentifier>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<language>
<xsl:choose>
<xsl:when
Expand All @@ -121,39 +116,30 @@ Mapping between :
</xsl:choose>
</language>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<characterSet>
<MD_CharacterSetCode codeList="./resources/codeList.xml#MD_CharacterSetCode"
codeListValue="utf8"/>
</characterSet>

<!-- parentIdentifier : service have no parent -->
<!-- mdHrLv -->

<hierarchyLevel>
<MD_ScopeCode
codeList="./resources/codeList.xml#MD_ScopeCode"
codeListValue="service"/>
</hierarchyLevel>

<!-- mdHrLvName -->

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<xsl:choose>
<xsl:when test="Service/ContactInformation|
wfs:Service/wfs:ContactInformation|
wms:Service/wms:ContactInformation|
ows:ServiceProvider|
owsg:ServiceProvider|
ows11:ServiceProvider|
ows2:ServiceProvider">
<xsl:for-each select="Service/ContactInformation|
wfs:Service/wfs:ContactInformation|
wms:Service/wms:ContactInformation|
<xsl:variable name="serviceProviderList"
select="Service/ContactInformation|
wfs:Service/wfs:ContactInformation|
wms:Service/wms:ContactInformation|
ows:ServiceProvider|
owsg:ServiceProvider|
ows11:ServiceProvider|
ows2:ServiceProvider">
owsg:ServiceProvider|
ows11:ServiceProvider|
ows2:ServiceProvider"/>
<xsl:choose>
<xsl:when test="$serviceProviderList">
<xsl:for-each select="$serviceProviderList">
<contact>
<CI_ResponsibleParty>
<xsl:apply-templates select="." mode="RespParty"/>
Expand All @@ -166,9 +152,8 @@ Mapping between :
</xsl:otherwise>
</xsl:choose>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<xsl:variable name="df">[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]</xsl:variable>

<dateStamp>
<xsl:choose>
<xsl:when test="//inspire_vs:ExtendedCapabilities/inspire_common:MetadataDate">
Expand All @@ -184,8 +169,6 @@ Mapping between :
</xsl:choose>
</dateStamp>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<metadataStandardName>
<gco:CharacterString>ISO 19119/2005</gco:CharacterString>
</metadataStandardName>
Expand All @@ -194,10 +177,6 @@ Mapping between :
<gco:CharacterString>1.0</gco:CharacterString>
</metadataStandardVersion>


<!--mdExtInfo-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<identificationInfo>
<srv:SV_ServiceIdentification>
<xsl:apply-templates select="." mode="SrvDataIdentification">
Expand All @@ -211,8 +190,6 @@ Mapping between :
</srv:SV_ServiceIdentification>
</identificationInfo>

<!--contInfo-->
<!--distInfo -->
<distributionInfo>
<MD_Distribution>
<distributionFormat>
Expand All @@ -232,6 +209,9 @@ Mapping between :
<linkage>
<URL>
<xsl:choose>
<xsl:when test="//wmts:Capabilities/wmts:ServiceMetadataURL">
<xsl:value-of select="//wmts:Capabilities/wmts:ServiceMetadataURL/@xlink:href"/>
</xsl:when>
<xsl:when test="$ows='true'">
<xsl:value-of select="//ows:Operation[@name='GetCapabilities']/ows:DCP/ows:HTTP/ows:Get/@xlink:href|
//ows11:Operation[@name='GetCapabilities']/ows11:DCP/ows11:HTTP/ows11:Get/@xlink:href|
Expand Down Expand Up @@ -267,6 +247,7 @@ Mapping between :
test="local-name(.)='WFS_MS_Capabilities' or local-name(.)='WFS_Capabilities'">
application/vnd.ogc.wfs_xml
</xsl:when>
<xsl:when test="local-name(.)='Capabilities' and namespace-uri(.)='http://www.opengis.net/wmts/1.0'">OGC:WMTS</xsl:when>
<xsl:otherwise>WWW:LINK-1.0-http--link</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
Expand Down Expand Up @@ -396,14 +377,7 @@ Mapping between :
</LI_Lineage>
</lineage>
</DQ_DataQuality>

</dataQualityInfo>
<!--mdConst -->
<!--mdMaint-->

</MD_Metadata>
</xsl:template>

<!-- ============================================================================= -->

</xsl:stylesheet>
Loading

0 comments on commit 5706648

Please sign in to comment.