本文整理汇总了Java中mil.nga.geopackage.projection.ProjectionFactory类的典型用法代码示例。如果您正苦于以下问题:Java ProjectionFactory类的具体用法?Java ProjectionFactory怎么用?Java ProjectionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectionFactory类属于mil.nga.geopackage.projection包,在下文中一共展示了ProjectionFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FeatureDao
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Constructor
*
* @param database
* @param db
* @param featureDb
* @param geometryColumns
* @param table
*/
public FeatureDao(String database, GeoPackageConnection db, FeatureConnection featureDb, GeometryColumns geometryColumns,
FeatureTable table) {
super(database, db, featureDb, table);
this.featureDb = featureDb;
this.geometryColumns = geometryColumns;
if (geometryColumns.getContents() == null) {
throw new GeoPackageException(GeometryColumns.class.getSimpleName()
+ " " + geometryColumns.getId() + " has null "
+ Contents.class.getSimpleName());
}
if (geometryColumns.getSrs() == null) {
throw new GeoPackageException(GeometryColumns.class.getSimpleName()
+ " " + geometryColumns.getId() + " has null "
+ SpatialReferenceSystem.class.getSimpleName());
}
projection = ProjectionFactory.getProjection(geometryColumns.getSrs());
}
示例2: getBoundingBox
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public BoundingBox getBoundingBox() {
Contents contents = geometryColumns.getContents();
BoundingBox boundingBox = contents.getBoundingBox();
if (boundingBox != null) {
Projection contentsProjection = ProjectionFactory
.getProjection(contents.getSrs());
if (!projection.equals(contentsProjection)) {
ProjectionTransform transform = contentsProjection
.getTransformation(projection);
boundingBox = transform.transform(boundingBox);
}
}
return boundingBox;
}
示例3: ElevationTilesCore
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Constructor
*
* @param geoPackage
* GeoPackage
* @param tileMatrixSet
* tile matrix set
* @param width
* specified results width
* @param height
* specified results height
* @param requestProjection
* request projection
*/
protected ElevationTilesCore(GeoPackageCore geoPackage,
TileMatrixSet tileMatrixSet, Integer width, Integer height,
Projection requestProjection) {
super(geoPackage);
this.tileMatrixSet = tileMatrixSet;
griddedCoverageDao = geoPackage.getGriddedCoverageDao();
griddedTileDao = geoPackage.getGriddedTileDao();
queryGriddedCoverage();
this.width = width;
this.height = height;
this.requestProjection = requestProjection;
elevationProjection = ProjectionFactory.getProjection(tileMatrixSet
.getSrs());
elevationBoundingBox = tileMatrixSet.getBoundingBox();
// Check if the projections have the same units
if (requestProjection != null) {
sameProjection = (requestProjection.getUnit().name
.equals(elevationProjection.getUnit().name));
} else {
sameProjection = true;
}
}
示例4: loadTiles
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Load tiles from a URL
*
* @param activity
* @param callback
* @param active
* @param database
* @param tableName
* @param tileUrl
* @param minZoom
* @param maxZoom
* @param compressFormat
* @param compressQuality
* @param googleTiles
* @param boundingBox
* @param epsg
*/
public static void loadTiles(Activity activity, ILoadTilesTask callback,
GeoPackageDatabases active, String database, String tableName,
String tileUrl, int minZoom, int maxZoom,
CompressFormat compressFormat, Integer compressQuality,
boolean googleTiles, BoundingBox boundingBox, long epsg) {
GeoPackageManager manager = GeoPackageFactory.getManager(activity);
GeoPackage geoPackage = manager.open(database);
Projection projection = ProjectionFactory.getProjection(epsg);
BoundingBox bbox = transform(boundingBox, projection);
TileGenerator tileGenerator = new UrlTileGenerator(activity, geoPackage,
tableName, tileUrl, minZoom, maxZoom, bbox, projection);
setTileGenerator(activity, tileGenerator, minZoom, maxZoom, compressFormat, compressQuality, googleTiles, boundingBox);
loadTiles(activity, callback, active, geoPackage, tableName, tileGenerator);
}
示例5: FeatureDao
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Constructor
*
* @param database
* @param db
* @param featureDb
* @param geometryColumns
* @param table
*/
public FeatureDao(String database, GeoPackageConnection db,
FeatureConnection featureDb, GeometryColumns geometryColumns,
FeatureTable table) {
super(database, db, featureDb, table);
this.featureDb = featureDb;
this.geometryColumns = geometryColumns;
if (geometryColumns.getContents() == null) {
throw new GeoPackageException(GeometryColumns.class.getSimpleName()
+ " " + geometryColumns.getId() + " has null "
+ Contents.class.getSimpleName());
}
if (geometryColumns.getSrs() == null) {
throw new GeoPackageException(GeometryColumns.class.getSimpleName()
+ " " + geometryColumns.getId() + " has null "
+ SpatialReferenceSystem.class.getSimpleName());
}
projection = ProjectionFactory.getProjection(geometryColumns.getSrs());
}
示例6: getBoundingBox
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public BoundingBox getBoundingBox() {
Contents contents = geometryColumns.getContents();
Projection contentsProjection = ProjectionFactory
.getProjection(contents.getSrs());
BoundingBox boundingBox = contents.getBoundingBox();
if (!projection.equals(contentsProjection)) {
ProjectionTransform transform = contentsProjection
.getTransformation(projection);
boundingBox = transform.transform(boundingBox);
}
return boundingBox;
}
示例7: projectGeometry
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* 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 = ProjectionFactory.getProjection(srs);
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);
}
}
}
示例8: queryFeatures
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Query for features in the bounding box
*
* @param boundingBox query bounding box
* @param projection bounding box projection
* @return feature index results, must be closed
*/
public FeatureIndexResults queryFeatures(BoundingBox boundingBox, Projection projection) {
if (projection == null) {
projection = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
}
// Query for features
FeatureIndexManager indexManager = featureTiles.getIndexManager();
if (indexManager == null) {
throw new GeoPackageException("Index Manager is not set on the Feature Tiles and is required to query indexed features");
}
FeatureIndexResults results = indexManager.query(boundingBox, projection);
return results;
}
示例9: getBoundingBox
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Get the bounding box as the provided projection
*
* @param projection
*/
public BoundingBox getBoundingBox(Projection projection) {
ProjectionTransform webMercatorToProjection = ProjectionFactory
.getProjection(ProjectionConstants.EPSG_WEB_MERCATOR)
.getTransformation(projection);
return webMercatorToProjection
.transform(webMercatorBoundingBox);
}
示例10: adjustGoogleBounds
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Adjust the tile matrix set and web mercator bounds for Google tile format
*/
private void adjustGoogleBounds() {
// Set the tile matrix set bounding box to be the world
BoundingBox standardWgs84Box = new BoundingBox(-ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH,
ProjectionConstants.WEB_MERCATOR_MIN_LAT_RANGE,
ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH,
ProjectionConstants.WEB_MERCATOR_MAX_LAT_RANGE);
ProjectionTransform wgs84ToWebMercatorTransform = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM)
.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
tileGridBoundingBox = wgs84ToWebMercatorTransform.transform(standardWgs84Box);
}
示例11: TileCreator
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* 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 = ProjectionFactory.getProjection(tileDao.getTileMatrixSet().getSrs());
tileSetBoundingBox = tileMatrixSet.getBoundingBox();
// Check if the projections have the same units
sameProjection = (requestProjection.getUnit().name.equals(tilesProjection.getUnit().name));
}
示例12: getElevation
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Get the elevation at the coordinate
*
* @param geoPackage GeoPackage
* @param algorithm algorithm
* @param latitude latitude
* @param longitude longitude
* @return elevation
* @throws Exception
*/
public static Double getElevation(GeoPackage geoPackage,
ElevationTilesAlgorithm algorithm, double latitude,
double longitude, long epsg) throws Exception {
Double elevation = null;
List<String> elevationTables = ElevationTilesPng.getTables(geoPackage);
TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao();
for (String elevationTable : elevationTables) {
TileMatrixSet tileMatrixSet = dao.queryForId(elevationTable);
TileDao tileDao = geoPackage.getTileDao(tileMatrixSet);
Projection requestProjection = ProjectionFactory
.getProjection(epsg);
// Test getting the elevation of a single coordinate
ElevationTilesPng elevationTiles = new ElevationTilesPng(geoPackage,
tileDao, requestProjection);
elevationTiles.setAlgorithm(algorithm);
elevation = elevationTiles.getElevation(latitude, longitude);
}
return elevation;
}
示例13: getElevations
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Get the elevations for the bounding box
*
* @param geoPackage GeoPackage
* @param algorithm algorithm
* @param boundingBox bounding box
* @param width results width
* @param width results height
* @return elevation tile results
* @throws Exception
*/
public static ElevationTileResults getElevations(GeoPackage geoPackage,
ElevationTilesAlgorithm algorithm, BoundingBox boundingBox,
int width, int height, long epsg) throws Exception {
ElevationTileResults elevations = null;
List<String> elevationTables = ElevationTilesPng.getTables(geoPackage);
TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao();
for (String elevationTable : elevationTables) {
TileMatrixSet tileMatrixSet = dao.queryForId(elevationTable);
TileDao tileDao = geoPackage.getTileDao(tileMatrixSet);
Projection requestProjection = ProjectionFactory
.getProjection(epsg);
// Test getting the elevation of a single coordinate
ElevationTilesPng elevationTiles = new ElevationTilesPng(geoPackage,
tileDao, requestProjection);
elevationTiles.setAlgorithm(algorithm);
elevationTiles.setWidth(width);
elevationTiles.setHeight(height);
elevations = elevationTiles.getElevations(boundingBox);
}
return elevations;
}
示例14: getElevation
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Get the elevation at the coordinate
*
* @param geoPackage GeoPackage
* @param algorithm algorithm
* @param latitude latitude
* @param longitude longitude
* @return elevation
* @throws Exception
*/
public static Double getElevation(GeoPackage geoPackage,
ElevationTilesAlgorithm algorithm, double latitude,
double longitude, long epsg) throws Exception {
Double elevation = null;
List<String> elevationTables = ElevationTilesTiff.getTables(geoPackage);
TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao();
for (String elevationTable : elevationTables) {
TileMatrixSet tileMatrixSet = dao.queryForId(elevationTable);
TileDao tileDao = geoPackage.getTileDao(tileMatrixSet);
Projection requestProjection = ProjectionFactory
.getProjection(epsg);
// Test getting the elevation of a single coordinate
ElevationTilesTiff elevationTiles = new ElevationTilesTiff(
geoPackage, tileDao, requestProjection);
elevationTiles.setAlgorithm(algorithm);
elevation = elevationTiles.getElevation(latitude, longitude);
}
return elevation;
}
示例15: getElevations
import mil.nga.geopackage.projection.ProjectionFactory; //导入依赖的package包/类
/**
* Get the elevations for the bounding box
*
* @param geoPackage GeoPackage
* @param algorithm algorithm
* @param boundingBox bounding box
* @param width results width
* @param width results height
* @return elevation tile results
* @throws Exception
*/
public static ElevationTileResults getElevations(GeoPackage geoPackage,
ElevationTilesAlgorithm algorithm, BoundingBox boundingBox,
int width, int height, long epsg) throws Exception {
ElevationTileResults elevations = null;
List<String> elevationTables = ElevationTilesTiff.getTables(geoPackage);
TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao();
for (String elevationTable : elevationTables) {
TileMatrixSet tileMatrixSet = dao.queryForId(elevationTable);
TileDao tileDao = geoPackage.getTileDao(tileMatrixSet);
Projection requestProjection = ProjectionFactory
.getProjection(epsg);
// Test getting the elevation of a single coordinate
ElevationTilesTiff elevationTiles = new ElevationTilesTiff(
geoPackage, tileDao, requestProjection);
elevationTiles.setAlgorithm(algorithm);
elevationTiles.setWidth(width);
elevationTiles.setHeight(height);
elevations = elevationTiles.getElevations(boundingBox);
}
return elevations;
}