From c760886258136cddffb6342e3aeb7ed3fa58a047 Mon Sep 17 00:00:00 2001 From: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:24:30 +0100 Subject: [PATCH 1/5] [Fixes #12763] 3D tiles geometricError mandatory field should be on tileset level ref to https://github.com/GeoNode/geonode/issues/12763 --- importer/handlers/tiles3d/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/importer/handlers/tiles3d/handler.py b/importer/handlers/tiles3d/handler.py index f7e58fb..b727363 100755 --- a/importer/handlers/tiles3d/handler.py +++ b/importer/handlers/tiles3d/handler.py @@ -124,7 +124,7 @@ def validate_3dtile_payload(payload): "The mandatory 'boundingVolume' for the key 'root' is missing" ) - error = payload.get("root", {}).get("geometricError", None) + error = payload.get("geometricError", None) or payload.get("root", {}).get("geometricError", None) if error is None: raise Invalid3DTilesException( "The mandatory 'geometricError' for the key 'root' is missing" From 6e83a275e63f017db6a732f90e122bf7c5b31ac9 Mon Sep 17 00:00:00 2001 From: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:36:15 +0100 Subject: [PATCH 2/5] fix tests --- importer/handlers/tiles3d/tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/importer/handlers/tiles3d/tests.py b/importer/handlers/tiles3d/tests.py index aee5595..bb35846 100755 --- a/importer/handlers/tiles3d/tests.py +++ b/importer/handlers/tiles3d/tests.py @@ -140,7 +140,6 @@ def test_validate_should_raise_exception_for_invalid_asset_key(self): def test_validate_should_raise_exception_for_invalid_root_boundingVolume(self): _json = { "asset": {"version": "1.1"}, - "geometricError": 1.0, "root": {"foo": {"box": []}, "geometricError": 0.0}, } _path = "/tmp/tileset.json" From 26bd81179a3193afc4534286c357f616d8ea39c5 Mon Sep 17 00:00:00 2001 From: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:42:52 +0100 Subject: [PATCH 3/5] Update tests.py --- importer/handlers/tiles3d/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/importer/handlers/tiles3d/tests.py b/importer/handlers/tiles3d/tests.py index bb35846..fdbcd6a 100755 --- a/importer/handlers/tiles3d/tests.py +++ b/importer/handlers/tiles3d/tests.py @@ -169,7 +169,7 @@ def test_validate_should_raise_exception_for_invalid_root_geometricError(self): self.assertIsNotNone(_exc) self.assertTrue( - "The mandatory 'geometricError' for the key 'root' is missing" + "The provided 3DTiles is not valid, some of the mandatory keys are missing. Mandatory keys are: 'asset', 'geometricError', 'root'" in str(_exc.exception.detail) ) os.remove(_path) From be0c0826f1e9d445421d459b55a6a8e04fb0dd42 Mon Sep 17 00:00:00 2001 From: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:47:38 +0100 Subject: [PATCH 4/5] Update test_end2end.py --- importer/tests/end2end/test_end2end.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/importer/tests/end2end/test_end2end.py b/importer/tests/end2end/test_end2end.py index db8225b..85c6baf 100644 --- a/importer/tests/end2end/test_end2end.py +++ b/importer/tests/end2end/test_end2end.py @@ -543,7 +543,7 @@ def test_import_wms(self): "lookup": resource_to_take, "parse_remote_metadata": True, } - initial_name = res.title + initial_name = res.title.lower().replace(" ", "_") assert_payload = { "subtype": "remote", "title": res.title, From 502ac5ac4666526abd4321bcbfea7134c6b0c019 Mon Sep 17 00:00:00 2001 From: Mattia <mattia.giupponi@gmail.com> Date: Mon, 2 Dec 2024 13:06:51 +0100 Subject: [PATCH 5/5] fix test --- importer/handlers/tiles3d/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/importer/handlers/tiles3d/tests.py b/importer/handlers/tiles3d/tests.py index fdbcd6a..52ae9b6 100755 --- a/importer/handlers/tiles3d/tests.py +++ b/importer/handlers/tiles3d/tests.py @@ -140,6 +140,7 @@ def test_validate_should_raise_exception_for_invalid_asset_key(self): def test_validate_should_raise_exception_for_invalid_root_boundingVolume(self): _json = { "asset": {"version": "1.1"}, + "geometricError": 1.0, "root": {"foo": {"box": []}, "geometricError": 0.0}, } _path = "/tmp/tileset.json" @@ -158,7 +159,6 @@ def test_validate_should_raise_exception_for_invalid_root_boundingVolume(self): def test_validate_should_raise_exception_for_invalid_root_geometricError(self): _json = { "asset": {"version": "1.1"}, - "geometricError": 1.0, "root": {"boundingVolume": {"box": []}, "foo": 0.0}, } _path = "/tmp/tileset.json"