Java Code Examples for mil.nga.sf.proj.Projection#getTransformation()
The following examples show how to use
mil.nga.sf.proj.Projection#getTransformation() .
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: GoogleMapShapeConverter.java From geopackage-android-map with MIT License | 6 votes |
/** * Constructor with specified projection, see * {@link FeatureDao#getProjection} * * @param projection projection */ public GoogleMapShapeConverter(Projection projection) { this.projection = projection; if (projection != null) { toWgs84 = projection .getTransformation(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); Projection wgs84 = toWgs84.getToProjection(); fromWgs84 = wgs84.getTransformation(projection); toWebMercator = projection.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); Projection webMercator = toWebMercator.getToProjection(); fromWebMercator = webMercator.getTransformation(projection); } else { toWgs84 = null; fromWgs84 = null; toWebMercator = null; fromWebMercator = null; } }
Example 2
Source File: FeatureTiles.java From geopackage-android with MIT License | 6 votes |
/** * Create an expanded bounding box to handle features outside the tile that * overlap * * @param boundingBox bounding box * @param projection bounding box projection * @return bounding box * @since 3.2.0 */ public BoundingBox expandBoundingBox(BoundingBox boundingBox, Projection projection) { BoundingBox expandedBoundingBox = boundingBox; ProjectionTransform toWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); if (!toWebMercator.isSameProjection()) { expandedBoundingBox = expandedBoundingBox.transform(toWebMercator); } expandedBoundingBox = expandBoundingBox(expandedBoundingBox); if (!toWebMercator.isSameProjection()) { ProjectionTransform fromWebMercator = toWebMercator .getInverseTransformation(); expandedBoundingBox = expandedBoundingBox .transform(fromWebMercator); } return expandedBoundingBox; }
Example 3
Source File: FeatureTiles.java From geopackage-java with MIT License | 6 votes |
/** * Create an expanded bounding box to handle features outside the tile that * overlap * * @param boundingBox * bounding box * @param projection * bounding box projection * @return bounding box * @since 3.2.0 */ public BoundingBox expandBoundingBox(BoundingBox boundingBox, Projection projection) { BoundingBox expandedBoundingBox = boundingBox; ProjectionTransform toWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); if (!toWebMercator.isSameProjection()) { expandedBoundingBox = expandedBoundingBox.transform(toWebMercator); } expandedBoundingBox = expandBoundingBox(expandedBoundingBox); if (!toWebMercator.isSameProjection()) { ProjectionTransform fromWebMercator = toWebMercator .getInverseTransformation(); expandedBoundingBox = expandedBoundingBox .transform(fromWebMercator); } return expandedBoundingBox; }
Example 4
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; }
Example 5
Source File: BoundedOverlay.java From geopackage-android-map with MIT License | 5 votes |
/** * Set the bounding box, provided as the indicated projection * * @param boundingBox bounding box * @param projection projection */ public void setBoundingBox(BoundingBox boundingBox, Projection projection) { ProjectionTransform projectionToWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); webMercatorBoundingBox = boundingBox .transform(projectionToWebMercator); }
Example 6
Source File: FeatureIndexer.java From geopackage-android with MIT License | 5 votes |
/** * Get the bounding box in the feature projection from the bounding box in * the provided projection * * @param boundingBox bounding box * @param projection projection * @return feature projected bounding box */ private BoundingBox getFeatureBoundingBox(BoundingBox boundingBox, Projection projection) { ProjectionTransform projectionTransform = projection .getTransformation(featureDao.getProjection()); BoundingBox featureBoundingBox = boundingBox .transform(projectionTransform); return featureBoundingBox; }
Example 7
Source File: FeatureInfoBuilder.java From geopackage-android-map with MIT License | 5 votes |
/** * Project the geometry into the provided projection * * @param geometryData geometry data * @param projection projection */ public void projectGeometry(GeoPackageGeometryData geometryData, Projection projection) { if (geometryData.getGeometry() != null) { try { SpatialReferenceSystemDao srsDao = DaoManager.createDao(featureDao.getDb().getConnectionSource(), SpatialReferenceSystem.class); int srsId = geometryData.getSrsId(); SpatialReferenceSystem srs = srsDao.queryForId((long) srsId); if (!projection.equals(srs.getOrganization(), srs.getOrganizationCoordsysId())) { Projection geomProjection = srs.getProjection(); ProjectionTransform transform = geomProjection.getTransformation(projection); Geometry projectedGeometry = transform.transform(geometryData.getGeometry()); geometryData.setGeometry(projectedGeometry); SpatialReferenceSystem projectionSrs = srsDao.getOrCreateCode(projection.getAuthority(), Long.parseLong(projection.getCode())); geometryData.setSrsId((int) projectionSrs.getSrsId()); } } catch (SQLException e) { throw new GeoPackageException("Failed to project geometry to projection with Authority: " + projection.getAuthority() + ", Code: " + projection.getCode(), e); } } }
Example 8
Source File: GeoPackageExample.java From geopackage-java with MIT License | 5 votes |
private static void createFeatureTileLinkExtension(GeoPackage geoPackage) throws SQLException, IOException { List<String> featureTables = geoPackage.getFeatureTables(); for (String featureTable : featureTables) { FeatureDao featureDao = geoPackage.getFeatureDao(featureTable); FeatureTiles featureTiles = new DefaultFeatureTiles(geoPackage, featureDao); BoundingBox boundingBox = featureDao.getBoundingBox(); Projection projection = featureDao.getProjection(); Projection requestProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WEB_MERCATOR); ProjectionTransform transform = projection .getTransformation(requestProjection); BoundingBox requestBoundingBox = boundingBox.transform(transform); int zoomLevel = TileBoundingBoxUtils .getZoomLevel(requestBoundingBox); zoomLevel = Math.max(zoomLevel, 8); zoomLevel = Math.min(zoomLevel, 19); int minZoom = zoomLevel - 8; int maxZoom = zoomLevel + 2; TileGenerator tileGenerator = new FeatureTileGenerator(geoPackage, featureTable + "_tiles", featureTiles, minZoom, maxZoom, requestBoundingBox, requestProjection); tileGenerator.generateTiles(); } }
Example 9
Source File: GeoPackageExample.java From geopackage-android with MIT License | 5 votes |
private static void createFeatureTileLinkExtension(Context context, GeoPackage geoPackage) throws SQLException, IOException { List<String> featureTables = geoPackage.getFeatureTables(); for (String featureTable : featureTables) { FeatureDao featureDao = geoPackage.getFeatureDao(featureTable); FeatureTiles featureTiles = new DefaultFeatureTiles(context, geoPackage, featureDao, context.getResources().getDisplayMetrics().density); BoundingBox boundingBox = featureDao.getBoundingBox(); Projection projection = featureDao.getProjection(); Projection requestProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WEB_MERCATOR); ProjectionTransform transform = projection .getTransformation(requestProjection); BoundingBox requestBoundingBox = boundingBox.transform(transform); int zoomLevel = TileBoundingBoxUtils .getZoomLevel(requestBoundingBox); zoomLevel = Math.max(zoomLevel, 8); zoomLevel = Math.min(zoomLevel, 19); int minZoom = zoomLevel - 8; int maxZoom = zoomLevel + 2; TileGenerator tileGenerator = new FeatureTileGenerator(context, geoPackage, featureTable + "_tiles", featureTiles, minZoom, maxZoom, requestBoundingBox, requestProjection); tileGenerator.generateTiles(); featureTiles.close(); } }
Example 10
Source File: GeoPackageGeometryDataUtils.java From geopackage-java with MIT License | 4 votes |
/** * Test transforming geometries between projections * * @param geoPackage * @throws SQLException * @throws IOException */ public static void testGeometryProjectionTransform(GeoPackage geoPackage) throws SQLException, IOException { GeometryColumnsDao geometryColumnsDao = geoPackage .getGeometryColumnsDao(); if (geometryColumnsDao.isTableExists()) { List<GeometryColumns> results = geometryColumnsDao.queryForAll(); for (GeometryColumns geometryColumns : results) { FeatureDao dao = geoPackage.getFeatureDao(geometryColumns); TestCase.assertNotNull(dao); FeatureResultSet cursor = dao.queryForAll(); while (cursor.moveToNext()) { GeoPackageGeometryData geometryData = cursor.getGeometry(); if (geometryData != null) { Geometry geometry = geometryData.getGeometry(); if (geometry != null) { SpatialReferenceSystemDao srsDao = geoPackage .getSpatialReferenceSystemDao(); long srsId = geometryData.getSrsId(); SpatialReferenceSystem srs = srsDao .queryForId(srsId); long epsg = srs.getOrganizationCoordsysId(); Projection projection = srs.getProjection(); long toEpsg = -1; if (epsg == ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM) { toEpsg = ProjectionConstants.EPSG_WEB_MERCATOR; } else { toEpsg = ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM; } ProjectionTransform transformTo = projection .getTransformation(toEpsg); ProjectionTransform transformFrom = srs .getTransformation(transformTo .getToProjection()); byte[] bytes = geometryData.getWkbBytes(); Geometry projectedGeometry = transformTo .transform(geometry); GeoPackageGeometryData projectedGeometryData = new GeoPackageGeometryData( -1); projectedGeometryData .setGeometry(projectedGeometry); projectedGeometryData.toBytes(); byte[] projectedBytes = projectedGeometryData .getWkbBytes(); if (epsg > 0) { TestCase.assertFalse(equalByteArrays(bytes, projectedBytes)); } Geometry restoredGeometry = transformFrom .transform(projectedGeometry); compareGeometries(geometry, restoredGeometry, .001); } } } cursor.close(); } } }
Example 11
Source File: CoverageDataTiffImportTest.java From geopackage-java with MIT License | 4 votes |
/** * Test 10 random locations and optionally print * * @throws Exception */ @Test public void testRandomLocations() throws Exception { BoundingBox projectedBoundingBox = null; List<String> coverageDataTables = CoverageDataTiff .getTables(geoPackage); TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao(); for (String coverageTable : coverageDataTables) { TileMatrixSet tileMatrixSet = dao.queryForId(coverageTable); BoundingBox boundingBox = tileMatrixSet.getBoundingBox(); if (PRINT) { System.out.println("Min Latitude: " + boundingBox.getMinLatitude()); System.out.println("Max Latitude: " + boundingBox.getMaxLatitude()); System.out.println("Min Longitude: " + boundingBox.getMinLongitude()); System.out.println("Max Longitude: " + boundingBox.getMaxLongitude()); System.out.println(); } SpatialReferenceSystemDao srsDao = geoPackage .getSpatialReferenceSystemDao(); long srsId = tileMatrixSet.getSrsId(); SpatialReferenceSystem srs = srsDao.queryForId(srsId); Projection projection = srs.getProjection(); Projection requestProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); ProjectionTransform coverageToRequest = projection .getTransformation(requestProjection); projectedBoundingBox = boundingBox.transform(coverageToRequest); } if (PRINT) { System.out.println("Min Latitude: " + projectedBoundingBox.getMinLatitude()); System.out.println("Max Latitude: " + projectedBoundingBox.getMaxLatitude()); System.out.println("Min Longitude: " + projectedBoundingBox.getMinLongitude()); System.out.println("Max Longitude: " + projectedBoundingBox.getMaxLongitude()); System.out.println(); } double latDistance = projectedBoundingBox.getMaxLatitude() - projectedBoundingBox.getMinLatitude(); double lonDistance = projectedBoundingBox.getMaxLongitude() - projectedBoundingBox.getMinLongitude(); for (int i = 0; i < 10; i++) { // Get a random coordinate double latitude = latDistance * .9 * Math.random() + projectedBoundingBox.getMinLatitude() + (.05 * latDistance); double longitude = lonDistance * .9 * Math.random() + projectedBoundingBox.getMinLongitude() + (.05 * lonDistance); testLocation(latitude, longitude); if (PRINT) { System.out.println(); } } }
Example 12
Source File: CoverageDataPngImportTest.java From geopackage-java with MIT License | 4 votes |
/** * Test 10 random locations and optionally print * * @throws Exception */ @Test public void testRandomLocations() throws Exception { BoundingBox projectedBoundingBox = null; List<String> coverageDataTables = CoverageDataPng.getTables(geoPackage); TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao(); for (String coverageTable : coverageDataTables) { TileMatrixSet tileMatrixSet = dao.queryForId(coverageTable); BoundingBox boundingBox = tileMatrixSet.getBoundingBox(); if (PRINT) { System.out.println("Min Latitude: " + boundingBox.getMinLatitude()); System.out.println("Max Latitude: " + boundingBox.getMaxLatitude()); System.out.println("Min Longitude: " + boundingBox.getMinLongitude()); System.out.println("Max Longitude: " + boundingBox.getMaxLongitude()); System.out.println(); } SpatialReferenceSystemDao srsDao = geoPackage .getSpatialReferenceSystemDao(); long srsId = tileMatrixSet.getSrsId(); SpatialReferenceSystem srs = srsDao.queryForId(srsId); Projection projection = srs.getProjection(); Projection requestProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); ProjectionTransform coverageToRequest = projection .getTransformation(requestProjection); projectedBoundingBox = boundingBox.transform(coverageToRequest); } if (PRINT) { System.out.println("Min Latitude: " + projectedBoundingBox.getMinLatitude()); System.out.println("Max Latitude: " + projectedBoundingBox.getMaxLatitude()); System.out.println("Min Longitude: " + projectedBoundingBox.getMinLongitude()); System.out.println("Max Longitude: " + projectedBoundingBox.getMaxLongitude()); System.out.println(); } double latDistance = projectedBoundingBox.getMaxLatitude() - projectedBoundingBox.getMinLatitude(); double lonDistance = projectedBoundingBox.getMaxLongitude() - projectedBoundingBox.getMinLongitude(); for (int i = 0; i < 10; i++) { // Get a random coordinate double latitude = latDistance * .9 * Math.random() + projectedBoundingBox.getMinLatitude() + (.05 * latDistance); double longitude = lonDistance * .9 * Math.random() + projectedBoundingBox.getMinLongitude() + (.05 * lonDistance); testLocation(latitude, longitude); if (PRINT) { System.out.println(); } } }
Example 13
Source File: GeoPackageGeometryDataUtils.java From geopackage-android with MIT License | 4 votes |
/** * Test transforming geometries between projections * * @param geoPackage * @throws SQLException * @throws IOException */ public static void testGeometryProjectionTransform(GeoPackage geoPackage) throws SQLException, IOException { GeometryColumnsDao geometryColumnsDao = geoPackage .getGeometryColumnsDao(); if (geometryColumnsDao.isTableExists()) { List<GeometryColumns> results = geometryColumnsDao.queryForAll(); for (GeometryColumns geometryColumns : results) { FeatureDao dao = geoPackage.getFeatureDao(geometryColumns); TestCase.assertNotNull(dao); FeatureCursor cursor = dao.queryForAll(); while (cursor.moveToNext()) { GeoPackageGeometryData geometryData = cursor.getGeometry(); if (geometryData != null) { Geometry geometry = geometryData.getGeometry(); if (geometry != null) { SpatialReferenceSystemDao srsDao = geoPackage .getSpatialReferenceSystemDao(); long srsId = geometryData.getSrsId(); SpatialReferenceSystem srs = srsDao .queryForId(srsId); long epsg = srs.getOrganizationCoordsysId(); Projection projection = srs.getProjection(); long toEpsg = -1; if (epsg == ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM) { toEpsg = ProjectionConstants.EPSG_WEB_MERCATOR; } else { toEpsg = ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM; } ProjectionTransform transformTo = projection .getTransformation(toEpsg); ProjectionTransform transformFrom = srs.getTransformation(transformTo .getToProjection()); byte[] bytes = geometryData.getWkbBytes(); Geometry projectedGeometry = transformTo .transform(geometry); GeoPackageGeometryData projectedGeometryData = new GeoPackageGeometryData( -1); projectedGeometryData .setGeometry(projectedGeometry); projectedGeometryData.toBytes(); byte[] projectedBytes = projectedGeometryData .getWkbBytes(); if (epsg > 0) { TestCase.assertFalse(equalByteArrays(bytes, projectedBytes)); } Geometry restoredGeometry = transformFrom .transform(projectedGeometry); compareGeometries(geometry, restoredGeometry, .001); } } } cursor.close(); } } }
Example 14
Source File: CoverageDataTiffImportTest.java From geopackage-android with MIT License | 4 votes |
/** * Test 10 random locations and optionally print * * @throws Exception */ @Test public void testRandomLocations() throws Exception { BoundingBox projectedBoundingBox = null; List<String> coverageDataTables = CoverageDataTiff.getTables(geoPackage); TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao(); for (String coverageTable : coverageDataTables) { TileMatrixSet tileMatrixSet = dao.queryForId(coverageTable); BoundingBox boundingBox = tileMatrixSet.getBoundingBox(); if (PRINT) { System.out.println("Min Latitude: " + boundingBox.getMinLatitude()); System.out.println("Max Latitude: " + boundingBox.getMaxLatitude()); System.out.println("Min Longitude: " + boundingBox.getMinLongitude()); System.out.println("Max Longitude: " + boundingBox.getMaxLongitude()); System.out.println(); } SpatialReferenceSystemDao srsDao = geoPackage .getSpatialReferenceSystemDao(); long srsId = tileMatrixSet.getSrsId(); SpatialReferenceSystem srs = srsDao.queryForId(srsId); Projection projection = srs.getProjection(); Projection requestProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); ProjectionTransform coverageToRequest = projection .getTransformation(requestProjection); projectedBoundingBox = boundingBox.transform(coverageToRequest); } if (PRINT) { System.out.println("Min Latitude: " + projectedBoundingBox.getMinLatitude()); System.out.println("Max Latitude: " + projectedBoundingBox.getMaxLatitude()); System.out.println("Min Longitude: " + projectedBoundingBox.getMinLongitude()); System.out.println("Max Longitude: " + projectedBoundingBox.getMaxLongitude()); System.out.println(); } double latDistance = projectedBoundingBox.getMaxLatitude() - projectedBoundingBox.getMinLatitude(); double lonDistance = projectedBoundingBox.getMaxLongitude() - projectedBoundingBox.getMinLongitude(); for (int i = 0; i < 10; i++) { // Get a random coordinate double latitude = latDistance * .9 * Math.random() + projectedBoundingBox.getMinLatitude() + (.05 * latDistance); double longitude = lonDistance * .9 * Math.random() + projectedBoundingBox.getMinLongitude() + (.05 * lonDistance); testLocation(latitude, longitude); if (PRINT) { System.out.println(); } } }
Example 15
Source File: CoverageDataPngImportTest.java From geopackage-android with MIT License | 4 votes |
/** * Test 10 random locations and optionally print * * @throws Exception */ @Test public void testRandomLocations() throws Exception { BoundingBox projectedBoundingBox = null; List<String> coverageDataTables = CoverageDataPng.getTables(geoPackage); TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao(); for (String coverageTable : coverageDataTables) { TileMatrixSet tileMatrixSet = dao.queryForId(coverageTable); BoundingBox boundingBox = tileMatrixSet.getBoundingBox(); if (PRINT) { System.out.println("Min Latitude: " + boundingBox.getMinLatitude()); System.out.println("Max Latitude: " + boundingBox.getMaxLatitude()); System.out.println("Min Longitude: " + boundingBox.getMinLongitude()); System.out.println("Max Longitude: " + boundingBox.getMaxLongitude()); System.out.println(); } SpatialReferenceSystemDao srsDao = geoPackage .getSpatialReferenceSystemDao(); long srsId = tileMatrixSet.getSrsId(); SpatialReferenceSystem srs = srsDao.queryForId(srsId); Projection projection = srs.getProjection(); Projection requestProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); ProjectionTransform coverageToRequest = projection .getTransformation(requestProjection); projectedBoundingBox = boundingBox.transform(coverageToRequest); } if (PRINT) { System.out.println("Min Latitude: " + projectedBoundingBox.getMinLatitude()); System.out.println("Max Latitude: " + projectedBoundingBox.getMaxLatitude()); System.out.println("Min Longitude: " + projectedBoundingBox.getMinLongitude()); System.out.println("Max Longitude: " + projectedBoundingBox.getMaxLongitude()); System.out.println(); } double latDistance = projectedBoundingBox.getMaxLatitude() - projectedBoundingBox.getMinLatitude(); double lonDistance = projectedBoundingBox.getMaxLongitude() - projectedBoundingBox.getMinLongitude(); for (int i = 0; i < 10; i++) { // Get a random coordinate double latitude = latDistance * .9 * Math.random() + projectedBoundingBox.getMinLatitude() + (.05 * latDistance); double longitude = lonDistance * .9 * Math.random() + projectedBoundingBox.getMinLongitude() + (.05 * lonDistance); testLocation(latitude, longitude); if (PRINT) { System.out.println(); } } }
Example 16
Source File: UserCoreDao.java From geopackage-core-java with MIT License | 3 votes |
/** * Project the provided bounding box in the declared projection to the user * DAO projection * * @param boundingBox * bounding box * @param projection * projection * @return projected bounding box * @since 3.1.0 */ public BoundingBox projectBoundingBox(BoundingBox boundingBox, Projection projection) { ProjectionTransform projectionTransform = projection .getTransformation(getProjection()); BoundingBox projectedBoundingBox = boundingBox .transform(projectionTransform); return projectedBoundingBox; }
Example 17
Source File: TileBoundingBoxUtils.java From geopackage-core-java with MIT License | 3 votes |
/** * Get the tile grid for the location specified as the projection * * @param point * point * @param zoom * zoom level * @param projection * projection * @return tile grid * @since 1.1.0 */ public static TileGrid getTileGrid(Point point, int zoom, Projection projection) { ProjectionTransform toWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); Point webMercatorPoint = toWebMercator.transform(point); BoundingBox boundingBox = new BoundingBox(webMercatorPoint.getX(), webMercatorPoint.getY(), webMercatorPoint.getX(), webMercatorPoint.getY()); return getTileGrid(boundingBox, zoom); }
Example 18
Source File: FeatureTableCoreIndex.java From geopackage-core-java with MIT License | 3 votes |
/** * Get the bounding box in the feature projection from the bounding box in * the provided projection * * @param boundingBox * bounding box * @param projection * projection * @return feature projected bounding box */ protected BoundingBox getFeatureBoundingBox(BoundingBox boundingBox, Projection projection) { ProjectionTransform projectionTransform = projection .getTransformation(getProjection()); BoundingBox featureBoundingBox = boundingBox .transform(projectionTransform); return featureBoundingBox; }
Example 19
Source File: SpatialReferenceSystem.java From geopackage-core-java with MIT License | 2 votes |
/** * 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); }
Example 20
Source File: FeatureTiles.java From geopackage-android with MIT License | 2 votes |
/** * 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); }