if (entry.getBounds() == null) { throw new IllegalArgumentException("Tile entry must specify bounds"); TileEntry e = new TileEntry(); e.init(entry); if (e.getTableName() == null) { e.setTableName("tiles"); if (e.getIdentifier() == null) { e.setIdentifier(e.getTableName()); if (e.getDescription() == null) { e.setDescription(e.getIdentifier()); if (e.getSrid() == null) { try { e.setSrid(findSRID(entry.getBounds())); } catch (Exception ex) { throw new IOException(ex); e.setLastChange(new Date()); Envelope bounds = e.getTileMatrixSetBounds(); if (bounds == null) { bounds = e.getBounds(); .set(e.getTableName()) .set(e.getSrid())
public TileEntry() { setDataType(DataType.Tile); }
void init(TileEntry e) { super.init(e); setTileMatricies(e.getTileMatricies()); this.tileMatrixSetBounds = e.tileMatrixSetBounds == null ? null : new ReferencedEnvelope(e.tileMatrixSetBounds); }
public GeoPackageReader(Object source, Hints hints) throws IOException { coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(this.hints); sourceFile = GeoPackageFormat.getFileFromSource(source); file = new GeoPackage(sourceFile, null, null, true); for (TileEntry tile : file.tiles()) { tiles.put(tile.getTableName(), tile); } // have a sane default when hit with no name, useful in particular // when the geopackage only has one coverage coverageName = tiles.keySet().iterator().next(); // add the overview count and allocate the final List<TileMatrix> tileMatricies = tiles.get(coverageName).getTileMatricies(); this.numOverviews = tileMatricies.size() - 1; overViewResolutions = new double[numOverviews][2]; // first tile matrix is the one with the lowest resolution, last one is native for (int i = 0; i < tileMatricies.size() - 1; i++) { final TileMatrix matrix = tileMatricies.get(i); overViewResolutions[tileMatricies.size() - i - 2] = new double[] {matrix.getXPixelSize(), matrix.getYPixelSize()}; } }
static TileEntry createTileEntry(ResultSet rs, Connection cx) throws SQLException, IOException { TileEntry e = new TileEntry(); initEntry(e, rs); + " WHERE table_name = ?" + " ORDER BY zoom_level ASC", e.getTableName(), TILE_MATRIX_METADATA)); try { psm.setString(1, e.getTableName()); m.setTiles(rsm.getBoolean("has_tiles")); e.getTileMatricies().add(m); TILE_MATRIX_SET, SPATIAL_REF_SYS)); try { psm.setString(1, e.getTableName()); e.setSrid(srid); crs = e.getBounds().getCoordinateReferenceSystem(); e.setTileMatrixSetBounds( new ReferencedEnvelope( rsm.getDouble("min_x"),
for (TileMatrix matrix : entry.getTileMatricies()) { if (!matrix.hasTiles()) { continue; for (TileMatrix matrix : entry.getTileMatricies()) { if (!matrix.hasTiles()) { continue; Envelope entryBounds = entry.getTileMatrixSetBounds(); double resX = bestMatrix.getXPixelSize() * bestMatrix.getTileWidth(); double resY = bestMatrix.getYPixelSize() * bestMatrix.getTileHeight(); return coverageFactory.create(entry.getTableName(), image, resultEnvelope);
+ (isRow ? "tile_row" : "tile_column") + ") FROM "); sql.append(entry.getTableName()); sql.append(" WHERE zoom_level == "); sql.append(zoom);
@Override protected double[] getHighestRes(String coverageName) { if (!checkName(coverageName)) { throw new IllegalArgumentException( "The specified coverageName " + coverageName + "is not supported"); } List<TileMatrix> matrices = tiles.get(coverageName).getTileMatricies(); TileMatrix matrix = matrices.get(matrices.size() - 1); return new double[] {matrix.getXPixelSize(), matrix.getYPixelSize()}; }
@Override public CoordinateReferenceSystem getCoordinateReferenceSystem(String coverageName) { if (!checkName(coverageName)) { throw new IllegalArgumentException( "The specified coverageName " + coverageName + "is not supported"); } try { return CRS.decode("EPSG:" + tiles.get(coverageName).getSrid(), true); } catch (Exception e) { LOGGER.log(Level.WARNING, e.getMessage(), e); return null; } }
@Override public GeneralEnvelope getOriginalEnvelope(String coverageName) { if (!checkName(coverageName)) { throw new IllegalArgumentException( "The specified coverageName " + coverageName + "is not supported"); } return new GeneralEnvelope(tiles.get(coverageName).getTileMatrixSetBounds()); }
static TileEntry createTileEntry(ResultSet rs, Connection cx) throws SQLException, IOException { TileEntry e = new TileEntry(); initEntry(e, rs); + " WHERE table_name = ?" + " ORDER BY zoom_level ASC", e.getTableName(), TILE_MATRIX_METADATA)); try { psm.setString(1, e.getTableName()); m.setTiles(rsm.getBoolean("has_tiles")); e.getTileMatricies().add(m); TILE_MATRIX_SET, SPATIAL_REF_SYS)); try { psm.setString(1, e.getTableName()); e.setSrid(srid); crs = e.getBounds().getCoordinateReferenceSystem(); e.setTileMatrixSetBounds( new ReferencedEnvelope( rsm.getDouble("min_x"),
for (TileMatrix matrix : entry.getTileMatricies()) { if (!matrix.hasTiles()) { continue; for (TileMatrix matrix : entry.getTileMatricies()) { if (!matrix.hasTiles()) { continue; Envelope entryBounds = entry.getTileMatrixSetBounds(); double resX = bestMatrix.getXPixelSize() * bestMatrix.getTileWidth(); double resY = bestMatrix.getYPixelSize() * bestMatrix.getTileHeight(); return coverageFactory.create(entry.getTableName(), image, resultEnvelope);
void init(TileEntry e) { super.init(e); setTileMatricies(e.getTileMatricies()); this.tileMatrixSetBounds = e.tileMatrixSetBounds == null ? null : new ReferencedEnvelope(e.tileMatrixSetBounds); }
public static enum DataType { Feature("features"), Raster("rasters"), Tile("tiles"), FeatureWithRaster("featuresWithRasters"); String value; DataType(String value) { this.value = value; } public String value() { return value; } }
@Override public GridEnvelope getOriginalGridRange(String coverageName) { if (!checkName(coverageName)) { throw new IllegalArgumentException( "The specified coverageName " + coverageName + "is not supported"); } List<TileMatrix> matrices = tiles.get(coverageName).getTileMatricies(); TileMatrix matrix = matrices.get(matrices.size() - 1); return new GridEnvelope2D( new Rectangle( matrix.getMatrixWidth() * matrix.getTileWidth(), matrix.getMatrixHeight() * matrix.getTileHeight())); }
@Override public CoordinateReferenceSystem getCoordinateReferenceSystem(String coverageName) { if (!checkName(coverageName)) { throw new IllegalArgumentException( "The specified coverageName " + coverageName + "is not supported"); } try { return CRS.decode("EPSG:" + tiles.get(coverageName).getSrid(), true); } catch (Exception e) { LOGGER.log(Level.WARNING, e.getMessage(), e); return null; } }
@Override public GeneralEnvelope getOriginalEnvelope(String coverageName) { if (!checkName(coverageName)) { throw new IllegalArgumentException( "The specified coverageName " + coverageName + "is not supported"); } return new GeneralEnvelope(tiles.get(coverageName).getTileMatrixSetBounds()); }
if (entry.getBounds() == null) { throw new IllegalArgumentException("Tile entry must specify bounds"); TileEntry e = new TileEntry(); e.init(entry); if (e.getTableName() == null) { e.setTableName("tiles"); if (e.getIdentifier() == null) { e.setIdentifier(e.getTableName()); if (e.getDescription() == null) { e.setDescription(e.getIdentifier()); if (e.getSrid() == null) { try { e.setSrid(findSRID(entry.getBounds())); } catch (Exception ex) { throw new IOException(ex); e.setLastChange(new Date()); Envelope bounds = e.getTileMatrixSetBounds(); if (bounds == null) { bounds = e.getBounds(); .set(e.getTableName()) .set(e.getSrid())
"INSERT INTO %s (zoom_level, tile_column," + " tile_row, tile_data) VALUES (?,?,?,?)", entry.getTableName())) .set(tile.getZoom()) .set(tile.getColumn())
@Override protected double[] getHighestRes(String coverageName) { if (!checkName(coverageName)) { throw new IllegalArgumentException( "The specified coverageName " + coverageName + "is not supported"); } List<TileMatrix> matrices = tiles.get(coverageName).getTileMatricies(); TileMatrix matrix = matrices.get(matrices.size() - 1); return new double[] {matrix.getXPixelSize(), matrix.getYPixelSize()}; }