/** * 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)); }
/** * Adjust the tile matrix set and bounds * * @param boundingBox bounding box * @param zoom zoom */ private void adjustBounds(BoundingBox boundingBox, int zoom) { // Google Tile Format if (googleTiles) { adjustGoogleBounds(); } else if (projection.getUnit() instanceof DegreeUnit) { adjustGeoPackageBoundsWGS84(boundingBox, zoom); } else { adjustGeoPackageBounds(boundingBox, zoom); } }
/** * Adjust the tile matrix set and bounds * * @param boundingBox * bounding box * @param zoom * zoom */ private void adjustBounds(BoundingBox boundingBox, int zoom) { // Google Tile Format if (googleTiles) { adjustGoogleBounds(); } else if (projection.getUnit() instanceof DegreeUnit) { adjustGeoPackageBoundsWGS84(boundingBox, zoom); } else { adjustGeoPackageBounds(boundingBox, zoom); } }
if (projection != null && projection.getUnit() != Units.METRES) { ProjectionTransform toWebMercator = projection .getTransformation(WEB_MERCATOR_PROJECTION); if (projection != null && projection.getUnit() != Units.METRES) { ProjectionTransform fromWebMercator = WEB_MERCATOR_PROJECTION .getTransformation(projection);
if (projection != null && projection.getUnit() != Units.METRES) { ProjectionTransform toWebMercator = projection .getTransformation(WEB_MERCATOR_PROJECTION); if (projection != null && projection.getUnit() != Units.METRES) { ProjectionTransform fromWebMercator = WEB_MERCATOR_PROJECTION .getTransformation(projection);
/** * Get the approximate zoom level of where the bounding box of the user data * fits into the world * * @return zoom level * @since 1.1.0 */ public int getZoomLevel() { Projection projection = getProjection(); if (projection == null) { throw new GeoPackageException( "No projection was set which is required to determine the zoom level"); } int zoomLevel = 0; BoundingBox boundingBox = getBoundingBox(); if (boundingBox != null) { if (projection.getUnit() instanceof DegreeUnit) { boundingBox = TileBoundingBoxUtils .boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox); } ProjectionTransform webMercatorTransform = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); BoundingBox webMercatorBoundingBox = boundingBox .transform(webMercatorTransform); zoomLevel = TileBoundingBoxUtils .getZoomLevel(webMercatorBoundingBox); } return zoomLevel; }
if (projection.getUnit() instanceof DegreeUnit) { boundingBox = TileBoundingBoxUtils .boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);
if (projection.getUnit() instanceof DegreeUnit) { zoomBoundingBox = TileBoundingBoxUtils .boundDegreesBoundingBoxWithWebMercatorLimits(zoomBoundingBox);
if (bboxProjection.getUnit() instanceof DegreeUnit) { boundingBox = TileBoundingBoxUtils .boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);