Java Code Examples for mil.nga.geopackage.tiles.TileBoundingBoxUtils#boundDegreesBoundingBoxWithWebMercatorLimits()
The following examples show how to use
mil.nga.geopackage.tiles.TileBoundingBoxUtils#boundDegreesBoundingBoxWithWebMercatorLimits() .
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: UserCoreDao.java From geopackage-core-java with MIT License | 6 votes |
/** * 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.isUnit(Units.DEGREES)) { boundingBox = TileBoundingBoxUtils .boundDegreesBoundingBoxWithWebMercatorLimits( boundingBox); } ProjectionTransform webMercatorTransform = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); BoundingBox webMercatorBoundingBox = boundingBox .transform(webMercatorTransform); zoomLevel = TileBoundingBoxUtils .getZoomLevel(webMercatorBoundingBox); } return zoomLevel; }