Skip to content

Commit

Permalink
Merge pull request #331 from CesiumGS/maxar-empty-extensions
Browse files Browse the repository at this point in the history
Follow-up for empty MAXAR and VRICON validators
  • Loading branch information
lilleyse authored Feb 17, 2025
2 parents c9c0712 + 206ad68 commit 3d70466
Show file tree
Hide file tree
Showing 22 changed files with 687 additions and 122 deletions.
9 changes: 5 additions & 4 deletions demos/validationOptionsDemo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ContentDataTypes } from "3d-tiles-tools";
import {
Validators,
ValidationOptions,
Expand All @@ -10,7 +11,7 @@ async function runWithIncluded() {
const options = ValidationOptions.fromJson({
validateContentData: true, // The default
includeContentTypes: [
"CONTENT_TYPE_B3DM", // Explicitly included here
ContentDataTypes.CONTENT_TYPE_B3DM, // Explicitly included here
],
excludeContentTypes: undefined, // The default
});
Expand All @@ -30,7 +31,7 @@ async function runWithoutIncluded() {
const options = ValidationOptions.fromJson({
validateContentData: true, // The default
includeContentTypes: [
//"CONTENT_TYPE_B3DM", // Not included here!
//ContentDataTypes.CONTENT_TYPE_B3DM, // Not included here!
],
excludeContentTypes: undefined, // The default
});
Expand All @@ -51,7 +52,7 @@ async function runWithExcluded() {
validateContentData: true, // The default
includeContentTypes: undefined, // The default
excludeContentTypes: [
"CONTENT_TYPE_B3DM" // Explicitly excluded here
ContentDataTypes.CONTENT_TYPE_B3DM // Explicitly excluded here
]
});
const tilesetFile = "specs/data/tilesets/validTilesetWithInvalidB3dm.json";
Expand All @@ -71,7 +72,7 @@ async function runWithoutExcluded() {
validateContentData: true, // The default
includeContentTypes: undefined, // The default
excludeContentTypes: [
// "CONTENT_TYPE_B3DM" // NOT Excluded here
// ContentDataTypes.CONTENT_TYPE_B3DM // NOT Excluded here
]
});
const tilesetFile = "specs/data/tilesets/validTilesetWithInvalidB3dm.json";
Expand Down
27 changes: 25 additions & 2 deletions specs/TilesetValidationSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,15 +936,38 @@ describe("Tileset validation", function () {
expect(result.get(0).type).toEqual("CONTENT_VALIDATION_INFO");
});

it("detects no issues in validTilesetWithInvalidI3dm", async function () {
it("detects no issues in validTilesetWithValid3tz", async function () {
const result = await Validators.validateTilesetFile(
"specs/data/tilesets/validTilesetWithValid3tz.json"
);
expect(result.length).toEqual(0);
});

it("detects issues in validTilesetWith3tzWithError", async function () {
const result = await Validators.validateTilesetFile(
"specs/data/tilesets/validTilesetWith3tzWithError.json"
);
expect(result.length).toEqual(1);
expect(result.get(0).type).toEqual("CONTENT_VALIDATION_ERROR");
});

it("detects issues in validTilesetWithInvalid3tz", async function () {
const result = await Validators.validateTilesetFile(
"specs/data/tilesets/validTilesetWithInvalid3tz.json"
);
expect(result.length).toEqual(1);
expect(result.get(0).type).toEqual("CONTENT_VALIDATION_ERROR");
});

it("detects issues in validTilesetWithInvalidI3dm", async function () {
const result = await Validators.validateTilesetFile(
"specs/data/tilesets/validTilesetWithInvalidI3dm.json"
);
expect(result.length).toEqual(1);
expect(result.get(0).type).toEqual("CONTENT_VALIDATION_ERROR");
});

it("detects no issues in validTilesetWithInvalidPnts", async function () {
it("detects issues in validTilesetWithInvalidPnts", async function () {
const result = await Validators.validateTilesetFile(
"specs/data/tilesets/validTilesetWithInvalidPnts.json"
);
Expand Down
37 changes: 37 additions & 0 deletions specs/data/extensions/maxarContentGeojson/lineString.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "UL",
"code": 12
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-75.61209430782448,
40.042530611425896
],
[
-75.61219430782448,
40.042530611425896
],
[
-75.61219430782448,
40.042630611425896
],
[
-75.61209430782448,
40.042630611425896
],
[
-75.61209430782448,
40.042530611425896
]
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"asset" : {
"version" : "1.1"
},
"geometricError" : 2.0,
"root" : {
"content": {
"uri": "lineString.geojson"
},
"refine": "REPLACE",
"boundingVolume" : {
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ]
},
"geometricError" : 1.0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"extras" : {
"info": {
"note": "The MAXAR_content_geojson example has been taken from the specification README.md"
}
},
"extensionsUsed": [
"MAXAR_content_geojson"
],
"extensionsRequired": [
"MAXAR_content_geojson"
],
"asset" : {
"version" : "1.1"
},
"schema": {
"id": "EXAMPLE_SCHEMA_ID",
"classes": {
"tileset": {
"properties": {
"content_type": {
"type": "STRING"
},
"geometry_model": {
"type": "STRING"
},
"name": {
"type": "STRING"
},
"schema": {
"type": "STRING"
},
"wff_version": {
"type": "STRING"
}
}
}
}
},
"metadata": {
"class": "tileset",
"properties": {
"content_type": "VECTOR",
"geometry_model": "OBJECTS",
"name": "Vegetation Layer",
"schema": "wff/15",
"wff_version": "1.5"
},
"extensions": {
"MAXAR_content_geojson": {
"propertiesSchemaUri": "vegetation_schema.json"
}
}
},
"geometricError" : 2.0,
"root" : {
"content": {
"uri": "lineString.geojson"
},
"refine": "REPLACE",
"boundingVolume" : {
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ]
},
"geometricError" : 1.0
}
}
51 changes: 51 additions & 0 deletions specs/data/extensions/maxarGrid/validTilesetWithMaxarGrid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"extras" : {
"info": {
"note": "The MAXAR_grid example has been taken from the specification README.md"
}
},
"extensionsUsed": [
"MAXAR_grid"
],
"extensions": {
"MAXAR_grid": {
"type": "quad",
"center": [3097202.3706942615, 500000.00000000122],
"size": [2088960.0, 2088960.0],
"srs": {
"referenceSystem": "ITRF2008",
"epoch": "2005.0",
"coordinateSystem": "UTM14N",
"elevation": "ELLIPSOID"
}
}
},
"asset" : {
"version" : "1.1"
},
"geometricError" : 2.0,
"root" : {
"refine": "REPLACE",
"boundingVolume" : {
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ]
},
"geometricError" : 1.0,
"extensions": {
"MAXAR_grid": {
"boundingBox": [
3425906.396465421,
500000.0000000012,
3546738.395635767,
694559.9877318252,
-581.1745009114966,
445.7444586344063
],
"index": [
5,
4
],
"level": 3
}
}
}
}
51 changes: 51 additions & 0 deletions specs/data/extensions/maxarGrid/validTilesetWithVriconGrid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"extras" : {
"info": {
"note": "The VRICON_grid is a legacy name for MAXAR_grid. The example here has been taken from the MAXAR_grid specification README.md"
}
},
"extensionsUsed": [
"VRICON_grid"
],
"extensions": {
"VRICON_grid": {
"type": "quad",
"center": [3097202.3706942615, 500000.00000000122],
"size": [2088960.0, 2088960.0],
"srs": {
"referenceSystem": "ITRF2008",
"epoch": "2005.0",
"coordinateSystem": "UTM14N",
"elevation": "ELLIPSOID"
}
}
},
"asset" : {
"version" : "1.1"
},
"geometricError" : 2.0,
"root" : {
"refine": "REPLACE",
"boundingVolume" : {
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ]
},
"geometricError" : 1.0,
"extensions": {
"VRICON_grid": {
"boundingBox": [
3425906.396465421,
500000.0000000012,
3546738.395635767,
694559.9877318252,
-581.1745009114966,
445.7444586344063
],
"index": [
5,
4
],
"level": 3
}
}
}
}
Loading

0 comments on commit 3d70466

Please sign in to comment.