Java Code Examples for mil.nga.geopackage.tiles.user.TileDao#getTileMatrixSet()
The following examples show how to use
mil.nga.geopackage.tiles.user.TileDao#getTileMatrixSet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoverageData.java From geopackage-android with MIT License | 5 votes |
/** * Get a Tiled Gridded Coverage Data * * @param geoPackage GeoPackage * @param tileDao tile dao * @param width coverage data response width * @param height coverage data response height * @param requestProjection request projection * @return coverage data */ public static CoverageData<?> getCoverageData(GeoPackage geoPackage, TileDao tileDao, Integer width, Integer height, Projection requestProjection) { TileMatrixSet tileMatrixSet = tileDao.getTileMatrixSet(); GriddedCoverageDao griddedCoverageDao = geoPackage .getGriddedCoverageDao(); GriddedCoverage griddedCoverage = null; try { if (griddedCoverageDao.isTableExists()) { griddedCoverage = griddedCoverageDao.query(tileMatrixSet); } } catch (SQLException e) { throw new GeoPackageException( "Failed to get Gridded Coverage for table name: " + tileMatrixSet.getTableName(), e); } CoverageData<?> coverageData = null; GriddedCoverageDataType dataType = griddedCoverage.getDataType(); switch (dataType) { case INTEGER: coverageData = new CoverageDataPng(geoPackage, tileDao, width, height, requestProjection); break; case FLOAT: coverageData = new CoverageDataTiff(geoPackage, tileDao, width, height, requestProjection); break; default: throw new GeoPackageException( "Unsupported Gridded Coverage Data Type: " + dataType); } return coverageData; }
Example 2
Source File: TileCreator.java From geopackage-android with MIT License | 5 votes |
/** * Constructor, specified tile size and projection * * @param tileDao tile dao * @param width requested width * @param height requested height * @param requestProjection requested projection */ public TileCreator(TileDao tileDao, Integer width, Integer height, Projection requestProjection) { this.tileDao = tileDao; this.width = width; this.height = height; this.requestProjection = requestProjection; tileMatrixSet = tileDao.getTileMatrixSet(); tilesProjection = tileDao.getTileMatrixSet().getProjection(); tileSetBoundingBox = tileMatrixSet.getBoundingBox(); // Check if the projections have the same units sameProjection = (requestProjection.getUnit().name.equals(tilesProjection.getUnit().name)); }
Example 3
Source File: CoverageData.java From geopackage-java with MIT License | 5 votes |
/** * Get a Tiled Gridded Coverage Data * * @param geoPackage * GeoPackage * @param tileDao * tile dao * @param width * coverage data response width * @param height * coverage data response height * @param requestProjection * request projection * @return coverage data */ public static CoverageData<?> getCoverageData(GeoPackage geoPackage, TileDao tileDao, Integer width, Integer height, Projection requestProjection) { TileMatrixSet tileMatrixSet = tileDao.getTileMatrixSet(); GriddedCoverageDao griddedCoverageDao = geoPackage .getGriddedCoverageDao(); GriddedCoverage griddedCoverage = null; try { if (griddedCoverageDao.isTableExists()) { griddedCoverage = griddedCoverageDao.query(tileMatrixSet); } } catch (SQLException e) { throw new GeoPackageException( "Failed to get Gridded Coverage for table name: " + tileMatrixSet.getTableName(), e); } CoverageData<?> coverageData = null; GriddedCoverageDataType dataType = griddedCoverage.getDataType(); switch (dataType) { case INTEGER: coverageData = new CoverageDataPng(geoPackage, tileDao, width, height, requestProjection); break; case FLOAT: coverageData = new CoverageDataTiff(geoPackage, tileDao, width, height, requestProjection); break; default: throw new GeoPackageException( "Unsupported Gridded Coverage Data Type: " + dataType); } return coverageData; }
Example 4
Source File: TileCreator.java From geopackage-java with MIT License | 5 votes |
/** * Constructor * * @param tileDao * tile dao * @param width * request width * @param height * request height * @param requestProjection * request projection * @param imageFormat * image format */ public TileCreator(TileDao tileDao, Integer width, Integer height, Projection requestProjection, String imageFormat) { this.tileDao = tileDao; this.width = width; this.height = height; this.requestProjection = requestProjection; this.imageFormat = imageFormat; if (imageFormat == null && (width != null || height != null)) { throw new GeoPackageException( "The width and height request size can not be specified when requesting raw tiles (no image format specified)"); } tileMatrixSet = tileDao.getTileMatrixSet(); tilesProjection = tileDao.getTileMatrixSet().getProjection(); tileSetBoundingBox = tileMatrixSet.getBoundingBox(); // Check if the projections have the same units sameProjection = (requestProjection.getUnit().name .equals(tilesProjection.getUnit().name)); if (imageFormat == null && !sameProjection) { throw new GeoPackageException( "The requested projection must be the same as the stored tiles when requesting raw tiles (no image format specified)"); } }
Example 5
Source File: GeoPackageTextOutput.java From geopackage-java with MIT License | 5 votes |
/** * Build text from a tile table * * @param table * tile table * @return text */ public String tileTable(String table) { StringBuilder output = new StringBuilder(); TileDao tileDao = geoPackage.getTileDao(table); output.append("Table Name: " + tileDao.getTableName()); long minZoom = tileDao.getMinZoom(); long maxZoom = tileDao.getMaxZoom(); output.append("\nMin Zoom: " + minZoom); output.append("\nMax Zoom: " + maxZoom); output.append("\nTiles: " + tileDao.count()); TileMatrixSet tileMatrixSet = tileDao.getTileMatrixSet(); output.append("\n\nContents\n\n") .append(textOutput(tileMatrixSet.getContents())); output.append("\n\nTile Matrix Set\n\n") .append(textOutput(tileMatrixSet)); output.append("\n\n Tile Matrices"); for (long zoom = minZoom; zoom <= maxZoom; zoom++) { TileMatrix tileMatrix = tileDao.getTileMatrix(zoom); if (tileMatrix != null) { output.append("\n\n").append(textOutput(tileMatrix)); output.append("\n\tTiles: " + tileDao.count(zoom)); BoundingBox boundingBox = tileDao.getBoundingBox(zoom); output.append("\n\tTile Bounds: \n") .append(textOutput(boundingBox)); } } return output.toString(); }
Example 6
Source File: TileProperties.java From geopackage-java with MIT License | 5 votes |
/** * Write the properties file using the tile dao * * @param tileDao * tile dao */ public void writeFile(TileDao tileDao) { try { PrintWriter pw = new PrintWriter(propertiesFile); TileMatrixSet tileMatrixSet = tileDao.getTileMatrixSet(); pw.println(GEOPACKAGE_PROPERTIES_EPSG + "=" + tileMatrixSet.getSrs().getOrganizationCoordsysId()); pw.println(GEOPACKAGE_PROPERTIES_MIN_X + "=" + tileMatrixSet.getMinX()); pw.println(GEOPACKAGE_PROPERTIES_MAX_X + "=" + tileMatrixSet.getMaxX()); pw.println(GEOPACKAGE_PROPERTIES_MIN_Y + "=" + tileMatrixSet.getMinY()); pw.println(GEOPACKAGE_PROPERTIES_MAX_Y + "=" + tileMatrixSet.getMaxY()); for (TileMatrix tileMatrix : tileDao.getTileMatrices()) { long zoom = tileMatrix.getZoomLevel(); pw.println(getMatrixWidthProperty(zoom) + "=" + tileMatrix.getMatrixWidth()); pw.println(getMatrixHeightProperty(zoom) + "=" + tileMatrix.getMatrixHeight()); } pw.close(); } catch (FileNotFoundException e) { throw new GeoPackageException( "GeoPackage file format properties file could not be created: " + propertiesFile, e); } }
Example 7
Source File: CoverageData.java From geopackage-android with MIT License | 3 votes |
/** * Constructor * * @param geoPackage GeoPackage * @param tileDao tile dao * @param width coverage data response width * @param height coverage data response height * @param requestProjection request projection */ public CoverageData(GeoPackage geoPackage, TileDao tileDao, Integer width, Integer height, Projection requestProjection) { super(geoPackage, tileDao .getTileMatrixSet(), width, height, requestProjection); this.tileDao = tileDao; }
Example 8
Source File: CoverageData.java From geopackage-java with MIT License | 3 votes |
/** * Constructor * * @param geoPackage * GeoPackage * @param tileDao * tile dao * @param width * coverage data response width * @param height * coverage data response height * @param requestProjection * request projection */ public CoverageData(GeoPackage geoPackage, TileDao tileDao, Integer width, Integer height, Projection requestProjection) { super(geoPackage, tileDao.getTileMatrixSet(), width, height, requestProjection); this.tileDao = tileDao; }