/** * Create a projection transformation from provided projection to Web Mercator * * @param projection projection from * @return transform */ protected ProjectionTransform getProjectionToWebMercatorTransform(Projection projection) { return projection.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); }
if (projection != null && projection.getUnit() != Units.METRES) { ProjectionTransform toWebMercator = projection .getTransformation(WEB_MERCATOR_PROJECTION); points = toWebMercator.transform(points); if (projection != null && projection.getUnit() != Units.METRES) { ProjectionTransform fromWebMercator = WEB_MERCATOR_PROJECTION .getTransformation(projection); simplifiedPoints = fromWebMercator.transform(simplifiedPoints);
if (!tileMatrixProjection.equals(projection)) { throw new GeoPackageException("Can not update tiles projected at " + tileMatrixProjection.getCode() + " with tiles projected at " + projection.getCode()); ProjectionTransform transformProjectionToContents = projection.getTransformation(contents.getProjection()); BoundingBox contentsBoundingBox = boundingBox; if (!transformProjectionToContents.isSameProjection()) { ProjectionTransform transformProjectionToTileMatrixSet = projection.getTransformation(tileMatrixProjection); boolean sameProjection = transformProjectionToTileMatrixSet.isSameProjection(); BoundingBox updateBoundingBox = boundingBox;
TestCase.assertEquals(tileDao.getProjection().getAuthority(), ProjectionConstants.AUTHORITY_EPSG); TestCase.assertEquals(Long.parseLong(tileDao.getProjection().getCode()), ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); BoundingBox wgs84BoundingBox = webMercatorBoundingBox.transform(webMercator.getTransformation(wgs84));
if (!projection.getAuthority().equals( ProjectionConstants.AUTHORITY_NONE)) { Projection queryProjection = null; if (projection.equals(ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR)) { queryProjection = ProjectionFactory.getProjection( .getTransformation(queryProjection);
TestCase.assertEquals(tileDao.getProjection().getAuthority(), ProjectionConstants.AUTHORITY_EPSG); TestCase.assertEquals(Long.parseLong(tileDao.getProjection().getCode()), ProjectionConstants.EPSG_WEB_MERCATOR);
envelope.getMaxY() + 1); Projection projection = null; if (!featureDao.getProjection().equals(ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM)) { projection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); .getTransformation(projection); BoundingBox transformedBoundingBox = boundingBox .transform(transform);
/** * 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)); }
if (!tileMatrixProjection.equals(projection)) { throw new GeoPackageException("Can not update tiles projected at " + tileMatrixProjection.getCode() + " with tiles projected at " + projection.getCode()); if (previousContentsBoundingBox != null) { ProjectionTransform transformProjectionToContents = projection .getTransformation(contents.getProjection()); BoundingBox contentsBoundingBox = boundingBox; if (!transformProjectionToContents.isSameProjection()) { .getTransformation(tileMatrixProjection); boolean sameProjection = transformProjectionToTileMatrixSet .isSameProjection();
.getSpatialReferenceSystemDao(); SpatialReferenceSystem srs = srsDao.getOrCreateCode( projection.getAuthority(), Long.parseLong(projection.getCode()));
envelope.getMaxY() + 1); Projection projection = null; if (!featureDao.getProjection().equals( ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM)) { .getTransformation(projection); BoundingBox transformedBoundingBox = boundingBox .transform(transform);
/** * 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); } }
/** * Create a projection transformation from WGS84 to Web Mercator * * @return transform */ protected ProjectionTransform getWgs84ToWebMercatorTransform() { return WGS_84_PROJECTION.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); }
if (projection != null && projection.getUnit() != Units.METRES) { ProjectionTransform toWebMercator = projection .getTransformation(WEB_MERCATOR_PROJECTION); points = toWebMercator.transform(points); if (projection != null && projection.getUnit() != Units.METRES) { ProjectionTransform fromWebMercator = WEB_MERCATOR_PROJECTION .getTransformation(projection); simplifiedPoints = fromWebMercator.transform(simplifiedPoints);
SpatialReferenceSystem srs = srsDao.getOrCreateCode(projection.getAuthority(), Long.parseLong(projection.getCode()));
/** * Create a projection transformation from the feature dao projection to Web * Mercator * * @return transform */ protected ProjectionTransform getWebMercatorTransform() { return this.featureDao.getProjection().getTransformation( ProjectionConstants.EPSG_WEB_MERCATOR); }
long count = 0; BoundingBox requestBoundingBox = null; if (projection.getUnit() instanceof DegreeUnit) { requestBoundingBox = boundingBox; } else { ProjectionTransform transform = projection.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); requestBoundingBox = boundingBox; if (!transform.isSameProjection()) { if (projection.getUnit() instanceof DegreeUnit) { tileGrid = TileBoundingBoxUtils.getTileGridWGS84(requestBoundingBox, zoom); } else {
/** * 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); } }
/** * Get the projection transform from the provided projection to the Spatial * Reference System projection * * @param projection * from projection * @return projection transform * @since 3.0.0 */ public ProjectionTransform getTransformation(Projection projection) { Projection projectionTo = getProjection(); return projection.getTransformation(projectionTo); }