Skip to content

Commit

Permalink
coverage data test and example changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bosborn committed Jul 26, 2018
1 parent c70902c commit 2ba8944
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ protected GeoPackage getGeoPackage() throws Exception {
.getSpatialReferenceSystemDao();
SpatialReferenceSystem contentsSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);
SpatialReferenceSystem tileMatrixSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
SpatialReferenceSystem tileMatrixSetSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);

CoverageDataPng coverageData = CoverageDataPng
.createTileTableWithMetadata(geoPackage,
TestConstants.CREATE_COVERAGE_DATA_DB_TABLE_NAME, bbox,
contentsSrs.getId(), bbox, tileMatrixSrs.getId());
contentsSrs.getId(), bbox, tileMatrixSetSrs.getId());
TileDao tileDao = coverageData.getTileDao();
TileMatrixSet tileMatrixSet = coverageData.getTileMatrixSet();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ protected GeoPackage getGeoPackage() throws Exception {
.getSpatialReferenceSystemDao();
SpatialReferenceSystem contentsSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);
SpatialReferenceSystem tileMatrixSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
SpatialReferenceSystem tileMatrixSetSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);

CoverageDataTiff coverageData = CoverageDataTiff
.createTileTableWithMetadata(geoPackage,
TestConstants.CREATE_COVERAGE_DATA_DB_TABLE_NAME, bbox,
contentsSrs.getId(), bbox, tileMatrixSrs.getId());
contentsSrs.getId(), bbox, tileMatrixSetSrs.getId());
TileDao tileDao = coverageData.getTileDao();
TileMatrixSet tileMatrixSet = coverageData.getTileMatrixSet();

Expand Down
50 changes: 32 additions & 18 deletions src/test/java/mil/nga/geopackage/test/GeoPackageExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -1114,22 +1114,29 @@ private static void createCoverageDataPngExtension(GeoPackage geoPackage)
BoundingBox bbox = new BoundingBox(-11667347.997449303,
4824705.2253603265, -11666125.00499674, 4825928.217812888);

int contentsEpsg = ProjectionConstants.EPSG_WEB_MERCATOR;
int tileMatrixSetEpsg = ProjectionConstants.EPSG_WEB_MERCATOR;

SpatialReferenceSystemDao srsDao = geoPackage
.getSpatialReferenceSystemDao();
SpatialReferenceSystem contentsSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);
SpatialReferenceSystem tileMatrixSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WEB_MERCATOR);
srsDao.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);

ProjectionTransform transform = ProjectionFactory.getProjection(
ProjectionConstants.EPSG_WEB_MERCATOR).getTransformation(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);
BoundingBox contentsBoundingBox = bbox.transform(transform);
SpatialReferenceSystem contentsSrs = srsDao
.getOrCreateFromEpsg(contentsEpsg);
SpatialReferenceSystem tileMatrixSetSrs = srsDao
.getOrCreateFromEpsg(tileMatrixSetEpsg);

ProjectionTransform transform = tileMatrixSetSrs.getProjection()
.getTransformation(contentsSrs.getProjection());
BoundingBox contentsBoundingBox = bbox;
if (!transform.isSameProjection()) {
contentsBoundingBox = bbox.transform(transform);
}

CoverageDataPng coverageData = CoverageDataPng
.createTileTableWithMetadata(geoPackage, "coverage_png",
contentsBoundingBox, contentsSrs.getId(), bbox,
tileMatrixSrs.getId());
tileMatrixSetSrs.getId());
TileDao tileDao = coverageData.getTileDao();
TileMatrixSet tileMatrixSet = coverageData.getTileMatrixSet();

Expand Down Expand Up @@ -1204,22 +1211,29 @@ private static void createCoverageDataTiffExtension(GeoPackage geoPackage)
BoundingBox bbox = new BoundingBox(-8593967.964158937,
4685284.085768163, -8592744.971706374, 4687730.070673289);

int contentsEpsg = ProjectionConstants.EPSG_WEB_MERCATOR;
int tileMatrixSetEpsg = ProjectionConstants.EPSG_WEB_MERCATOR;

SpatialReferenceSystemDao srsDao = geoPackage
.getSpatialReferenceSystemDao();
SpatialReferenceSystem contentsSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);
SpatialReferenceSystem tileMatrixSrs = srsDao
.getOrCreateFromEpsg(ProjectionConstants.EPSG_WEB_MERCATOR);
srsDao.getOrCreateFromEpsg(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);

ProjectionTransform transform = ProjectionFactory.getProjection(
ProjectionConstants.EPSG_WEB_MERCATOR).getTransformation(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D);
BoundingBox contentsBoundingBox = bbox.transform(transform);
SpatialReferenceSystem contentsSrs = srsDao
.getOrCreateFromEpsg(contentsEpsg);
SpatialReferenceSystem tileMatrixSetSrs = srsDao
.getOrCreateFromEpsg(tileMatrixSetEpsg);

ProjectionTransform transform = tileMatrixSetSrs.getProjection()
.getTransformation(contentsSrs.getProjection());
BoundingBox contentsBoundingBox = bbox;
if (!transform.isSameProjection()) {
contentsBoundingBox = bbox.transform(transform);
}

CoverageDataTiff coverageData = CoverageDataTiff
.createTileTableWithMetadata(geoPackage, "coverage_tiff",
contentsBoundingBox, contentsSrs.getId(), bbox,
tileMatrixSrs.getId());
tileMatrixSetSrs.getId());
TileDao tileDao = coverageData.getTileDao();
TileMatrixSet tileMatrixSet = coverageData.getTileMatrixSet();

Expand Down

0 comments on commit 2ba8944

Please sign in to comment.