Skip to content

Commit

Permalink
allow for a 1 meter bounds tolerance as specified in the DGIWG spec c…
Browse files Browse the repository at this point in the history
…onformance test
  • Loading branch information
bosborn committed Mar 14, 2024
1 parent 1b509f0 commit 0f44399
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/main/java/mil/nga/geopackage/dgiwg/DGIWGValidate.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
*/
public class DGIWGValidate {

/**
* Tile Matrix Set bounds tolerance in meters. 1 meter as defined in
* "Conformance Class Bounding Box (bbox)".
*/
public static final double TILE_MATRIX_SET_BOUNDS_TOLERANCE = 1.0;

/**
* Is the GeoPackage valid according to the DGIWG GeoPackage Profile
*
Expand Down Expand Up @@ -373,8 +379,8 @@ public static DGIWGValidationErrors validateTileTable(
String crsBounds = "CRS " + crs.getAuthorityAndCode()
+ " Bounds: " + boundingBox;

if (tileMatrixSet.getMinX() < boundingBox
.getMinLongitude()) {
if (tileMatrixSet.getMinX() < boundingBox.getMinLongitude()
- TILE_MATRIX_SET_BOUNDS_TOLERANCE) {
errors.add(new DGIWGValidationError(
TileMatrixSet.TABLE_NAME,
TileMatrixSet.COLUMN_MIN_X,
Expand All @@ -383,8 +389,8 @@ public static DGIWGValidationErrors validateTileTable(
primaryKey(tileMatrixSet)));
}

if (tileMatrixSet.getMinY() < boundingBox
.getMinLatitude()) {
if (tileMatrixSet.getMinY() < boundingBox.getMinLatitude()
- TILE_MATRIX_SET_BOUNDS_TOLERANCE) {
errors.add(new DGIWGValidationError(
TileMatrixSet.TABLE_NAME,
TileMatrixSet.COLUMN_MIN_Y,
Expand All @@ -393,8 +399,8 @@ public static DGIWGValidationErrors validateTileTable(
primaryKey(tileMatrixSet)));
}

if (tileMatrixSet.getMaxX() > boundingBox
.getMaxLongitude()) {
if (tileMatrixSet.getMaxX() > boundingBox.getMaxLongitude()
+ TILE_MATRIX_SET_BOUNDS_TOLERANCE) {
errors.add(new DGIWGValidationError(
TileMatrixSet.TABLE_NAME,
TileMatrixSet.COLUMN_MAX_X,
Expand All @@ -403,8 +409,8 @@ public static DGIWGValidationErrors validateTileTable(
primaryKey(tileMatrixSet)));
}

if (tileMatrixSet.getMaxY() > boundingBox
.getMaxLatitude()) {
if (tileMatrixSet.getMaxY() > boundingBox.getMaxLatitude()
+ TILE_MATRIX_SET_BOUNDS_TOLERANCE) {
errors.add(new DGIWGValidationError(
TileMatrixSet.TABLE_NAME,
TileMatrixSet.COLUMN_MAX_Y,
Expand Down

0 comments on commit 0f44399

Please sign in to comment.