From e9277aa108f9176498d5edbfba57293985051666 Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Wed, 24 Jun 2020 10:37:19 +0200 Subject: [PATCH 1/7] Editor / Polygon / Fix validation error on srsName and id attributes. When adding bounding polygon, issues are reported on validation. ![image](https://user-images.githubusercontent.com/1701393/85522811-6d6adb80-b606-11ea-8c02-726e4d61f55e.png) Since OL6 update, an srsName is added to LinearRing in GML3.2.0. ![image](https://user-images.githubusercontent.com/1701393/85522835-722f8f80-b606-11ea-87c6-a8056e1ae5b9.png) GML2 OL format was not. See https://github.com/openlayers/openlayers/blame/v6.3.1/src/ol/format/GML2.js#L228 . GML3 does https://github.com/openlayers/openlayers/blob/v6.3.1/src/ol/format/GML3.js#L503 From the XSD, this attribute should probably not be added https://schemas.wmo.int/wmdr/1.0RC6/documentation/schemadoc/schemas/geometryBasic2d_xsd/elements/LinearRing.html. Workaround that issue by updating `LinearRing` in `update-fixed-info.xsl`. --- .../iso19139/update-fixed-info-subtemplate.xsl | 2 +- .../src/main/plugin/iso19139/update-fixed-info.xsl | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info-subtemplate.xsl b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info-subtemplate.xsl index 13a8902f7aa..4159ff3307e 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info-subtemplate.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info-subtemplate.xsl @@ -175,7 +175,7 @@ - + diff --git a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl index c465b055f30..a5ce7285e7a 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl @@ -274,6 +274,8 @@ + + @@ -288,10 +290,10 @@ - + @@ -479,10 +481,10 @@ - From 2969e71f21e814abd538e51c374c856702ab4445 Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Wed, 24 Jun 2020 11:10:12 +0200 Subject: [PATCH 2/7] Editor / Polygon / Fix validation error on srsName and id attributes / Preserve existing. --- .../src/main/plugin/iso19139/update-fixed-info.xsl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl index a5ce7285e7a..96002a2bc01 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl @@ -305,10 +305,14 @@ - + - urn:ogc:def:crs:EPSG:6.6:4326 + From 30d14732790ca056014ae21dac92ceeb21a7c8dd Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Wed, 24 Jun 2020 12:57:50 +0200 Subject: [PATCH 3/7] Editor / Polygon / Fix validation error on srsName and id attributes / Avoid xmlns attribute. --- schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl index 96002a2bc01..f3a7f90f084 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl @@ -314,7 +314,7 @@ - + From fb97cff3717ec00adf7a278b26b51b023b44dd2d Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Thu, 2 Jul 2020 09:27:33 +0200 Subject: [PATCH 4/7] Editor / Polygon / Fix validation error on srsName and id attributes. Avoid empty xmlns by cleaning gml namespaces of all elements. --- .../main/plugin/iso19139/update-fixed-info.xsl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl index f3a7f90f084..989e06199db 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl @@ -289,6 +289,7 @@ + - + + + + + + + + + + + + + + + From 1966f5e3b03ced22848d49871bafd48baae5f9d1 Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Thu, 2 Jul 2020 15:47:26 +0200 Subject: [PATCH 5/7] Editor / Polygon / Fix validation error on srsName and id attributes. --- .../src/main/java/org/fao/geonet/api/records/MetadataApi.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java b/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java index 09cf1df01f5..5e7b4aca64e 100644 --- a/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java @@ -321,8 +321,7 @@ Object getRecordAsXML( metadata.getUuid(), isJson ? "json" : "xml" )); - return isJson ? Xml.getJSON(xml) : xml; - //return xml; + return isJson ? Xml.getJSON(xml) : Xml.getString(xml); } @ApiOperation( From f176dad4e170746472568f3ee68a95d4f494d3cb Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Fri, 3 Jul 2020 10:06:23 +0200 Subject: [PATCH 6/7] Editor / Polygon / Fix validation error on srsName and id attributes / Avoid xmlns='' attribute and keep GML namesapce declaration at the root document level only. Thanks josegar74 for helping on that. --- .../plugin/iso19139/update-fixed-info.xsl | 108 ++++++++++-------- .../fao/geonet/api/records/MetadataApi.java | 2 +- 2 files changed, 63 insertions(+), 47 deletions(-) diff --git a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl index 989e06199db..cf158890718 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl @@ -77,10 +77,10 @@ - - - - + + + + - + @@ -294,18 +294,18 @@ - - - - - - - - - - + gml320:Polygon[not(@gml320:id) or not(@srsName)]| + gml320:MultiSurface[not(@gml:id) or not(@srsName)]| + gml320:LineString[not(@gml:id) or not(@srsName)]"> + + + - + - - - - - - - - - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -666,6 +661,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -682,20 +697,21 @@ - + - + - + + select="'gml'"/> + diff --git a/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java b/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java index 5e7b4aca64e..f50b0e1be83 100644 --- a/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java @@ -321,7 +321,7 @@ Object getRecordAsXML( metadata.getUuid(), isJson ? "json" : "xml" )); - return isJson ? Xml.getJSON(xml) : Xml.getString(xml); + return isJson ? Xml.getJSON(xml) : xml; } @ApiOperation( From 0d088b35e4ea348b379143b2e0d4754f412a031f Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Fri, 3 Jul 2020 11:56:53 +0200 Subject: [PATCH 7/7] Editor / Polygon / Fix validation error on srsName and id attributes. --- .../iso19139/src/main/plugin/iso19139/update-fixed-info.xsl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl index cf158890718..7ee5b1c6fab 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl @@ -259,8 +259,10 @@ - +