本文整理汇总了Java中mil.nga.geopackage.projection.ProjectionConstants类的典型用法代码示例。如果您正苦于以下问题:Java ProjectionConstants类的具体用法?Java ProjectionConstants怎么用?Java ProjectionConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectionConstants类属于mil.nga.geopackage.projection包,在下文中一共展示了ProjectionConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBoundingBox
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Get the WGS84 bounding box of the current map view screen.
* The max longitude will be larger than the min resulting in values larger than 180.0.
*
* @param map google map
* @return current bounding box
*/
public static BoundingBox getBoundingBox(GoogleMap map) {
LatLngBounds visibleBounds = map.getProjection()
.getVisibleRegion().latLngBounds;
LatLng southwest = visibleBounds.southwest;
LatLng northeast = visibleBounds.northeast;
double minLatitude = southwest.latitude;
double maxLatitude = northeast.latitude;
double minLongitude = southwest.longitude;
double maxLongitude = northeast.longitude;
if (maxLongitude < minLongitude) {
maxLongitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH);
}
BoundingBox boundingBox = new BoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude);
return boundingBox;
}
示例2: GoogleMapShapeConverter
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Constructor with specified projection, see
* {@link FeatureDao#getProjection}
*
* @param 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;
}
}
示例3: testLocation
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Test a single location
*
* @param latitude
* @param longitude
* @throws Exception
*/
private void testLocation(double latitude, double longitude)
throws Exception {
if (PRINT) {
System.out.println("Latitude: " + latitude);
System.out.println("Longitude: " + longitude);
}
for (ElevationTilesAlgorithm algorithm : ElevationTilesAlgorithm
.values()) {
Double elevation = ElevationTilesTiffTestUtils.getElevation(
geoPackage, algorithm, latitude, longitude,
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
if (PRINT) {
System.out.println(algorithm.name() + ": " + elevation);
}
}
}
示例4: testLocation
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Test a single location
*
* @param latitude
* @param longitude
* @throws Exception
*/
private void testLocation(double latitude, double longitude)
throws Exception {
if (PRINT) {
System.out.println("Latitude: " + latitude);
System.out.println("Longitude: " + longitude);
}
for (ElevationTilesAlgorithm algorithm : ElevationTilesAlgorithm
.values()) {
Double elevation = ElevationTilesPngTestUtils.getElevation(geoPackage,
algorithm, latitude, longitude,
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
if (PRINT) {
System.out.println(algorithm.name() + ": " + elevation);
}
}
}
示例5: createFeatureDao
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Create feature dao
*
* @return
*/
public static FeatureDao createFeatureDao(GeoPackage geoPackage) {
BoundingBox boundingBox = new BoundingBox();
GeometryColumns geometryColumns = new GeometryColumns();
geometryColumns.setId(new TableColumnKey("feature_tiles",
"geom"));
geometryColumns.setGeometryType(GeometryType.GEOMETRY);
geometryColumns.setZ((byte) 0);
geometryColumns.setM((byte) 0);
geoPackage.createFeatureTableWithMetadata(
geometryColumns, boundingBox, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns);
return featureDao;
}
示例6: getZoomLevel
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* 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 = webMercatorTransform
.transform(boundingBox);
zoomLevel = TileBoundingBoxUtils
.getZoomLevel(webMercatorBoundingBox);
}
return zoomLevel;
}
示例7: getWebMercatorBoundingBox
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Get the Web Mercator tile bounding box from the Google Maps API tile
* coordinates and zoom level
*
* @param x
* x coordinate
* @param y
* y coordinate
* @param zoom
* zoom level
* @return bounding box
*/
public static BoundingBox getWebMercatorBoundingBox(long x, long y, int zoom) {
double tileSize = tileSizeWithZoom(zoom);
double minLon = (-1 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH)
+ (x * tileSize);
double maxLon = (-1 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH)
+ ((x + 1) * tileSize);
double minLat = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH
- ((y + 1) * tileSize);
double maxLat = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH
- (y * tileSize);
BoundingBox box = new BoundingBox(minLon, minLat, maxLon, maxLat);
return box;
}
示例8: getTileGrid
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Get the tile grid that includes the entire tile bounding box
*
* @param webMercatorBoundingBox
* web mercator bounding box
* @param zoom
* zoom level
* @return tile grid
*/
public static TileGrid getTileGrid(BoundingBox webMercatorBoundingBox,
int zoom) {
int tilesPerSide = tilesPerSide(zoom);
double tileSize = tileSize(tilesPerSide);
int minX = (int) ((webMercatorBoundingBox.getMinLongitude() + ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) / tileSize);
double tempMaxX = (webMercatorBoundingBox.getMaxLongitude() + ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH)
/ tileSize;
int maxX = (int) (tempMaxX - ProjectionConstants.WEB_MERCATOR_PRECISION);
maxX = Math.min(maxX, tilesPerSide - 1);
int minY = (int) (((webMercatorBoundingBox.getMaxLatitude() - ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) * -1) / tileSize);
double tempMaxY = ((webMercatorBoundingBox.getMinLatitude() - ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) * -1)
/ tileSize;
int maxY = (int) (tempMaxY - ProjectionConstants.WEB_MERCATOR_PRECISION);
maxY = Math.min(maxY, tilesPerSide - 1);
TileGrid grid = new TileGrid(minX, minY, maxX, maxY);
return grid;
}
示例9: getZoomLevel
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Get the zoom level of where the web mercator bounding box fits into the
* complete world
*
* @param webMercatorBoundingBox
* web mercator bounding box
* @return zoom level
*/
public static int getZoomLevel(BoundingBox webMercatorBoundingBox) {
double worldLength = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH * 2;
int widthTiles = (int) (worldLength / (webMercatorBoundingBox
.getMaxLongitude() - webMercatorBoundingBox.getMinLongitude()));
int heightTiles = (int) (worldLength / (webMercatorBoundingBox
.getMaxLatitude() - webMercatorBoundingBox.getMinLatitude()));
int tilesPerSide = Math.min(widthTiles, heightTiles);
tilesPerSide = Math.max(tilesPerSide, 1);
int zoom = zoomFromTilesPerSide(tilesPerSide);
return zoom;
}
示例10: getWGS84BoundingBox
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Get the WGS84 tile bounding box from the tile grid and zoom level
*
* @param tileGrid
* tile grid
* @param zoom
* zoom
*
* @return wgs84 bounding box
* @since 1.2.0
*/
public static BoundingBox getWGS84BoundingBox(TileGrid tileGrid, int zoom) {
int tilesPerLat = tilesPerWGS84LatSide(zoom);
int tilesPerLon = tilesPerWGS84LonSide(zoom);
double tileSizeLat = tileSizeLatPerWGS84Side(tilesPerLat);
double tileSizeLon = tileSizeLonPerWGS84Side(tilesPerLon);
double minLon = (-1 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)
+ (tileGrid.getMinX() * tileSizeLon);
double maxLon = (-1 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)
+ ((tileGrid.getMaxX() + 1) * tileSizeLon);
double minLat = ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT
- ((tileGrid.getMaxY() + 1) * tileSizeLat);
double maxLat = ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT
- (tileGrid.getMinY() * tileSizeLat);
BoundingBox box = new BoundingBox(minLon, minLat, maxLon, maxLat);
return box;
}
示例11: testLocation
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Test a single location
*
* @param latitude
* @param longitude
* @throws Exception
*/
private void testLocation(double latitude, double longitude)
throws Exception {
if (PRINT) {
System.out.println("Latitude: " + latitude);
System.out.println("Longitude: " + longitude);
}
for (ElevationTilesAlgorithm algorithm : ElevationTilesAlgorithm
.values()) {
Double elevation = ElevationTilesTiffTestUtils.getElevation(
geoPackage, algorithm, latitude, longitude,
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
if (PRINT) {
System.out.println(algorithm.name() + ": " + elevation);
}
}
}
示例12: testLocation
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Test a single location
*
* @param latitude
* @param longitude
* @throws Exception
*/
private void testLocation(double latitude, double longitude)
throws Exception {
if (PRINT) {
System.out.println("Latitude: " + latitude);
System.out.println("Longitude: " + longitude);
}
for (ElevationTilesAlgorithm algorithm : ElevationTilesAlgorithm
.values()) {
Double elevation = ElevationTilesPngTestUtils.getElevation(
geoPackage, algorithm, latitude, longitude,
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
if (PRINT) {
System.out.println(algorithm.name() + ": " + elevation);
}
}
}
示例13: createFeatureDao
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Create feature dao
*
* @return feature dao
*/
public static FeatureDao createFeatureDao(GeoPackage geoPackage) {
BoundingBox boundingBox = new BoundingBox();
GeometryColumns geometryColumns = new GeometryColumns();
geometryColumns.setId(new TableColumnKey(TABLE_NAME, "geom"));
geometryColumns.setGeometryType(GeometryType.GEOMETRY);
geometryColumns.setZ((byte) 0);
geometryColumns.setM((byte) 0);
geoPackage.createFeatureTableWithMetadata(geometryColumns, boundingBox,
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns);
return featureDao;
}
示例14: OsmMapShapeConverter
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Constructor with specified projection, see
*
* @param projection
*/
public OsmMapShapeConverter(Projection projection, MarkerOptions options, PolylineOptions polylineOptions,
PolygonOptions polygonOptions) {
Log.i(IMapView.LOGTAG, "Geopackage support is BETA. Please report any issues");
this.projection = projection;
this.polylineOptions=polylineOptions;
this.polygonOptions=polygonOptions;
this.makerOptions=options;
if (projection != null) {
toWgs84 = projection
.getTransformation(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
Projection wgs84 = toWgs84.getToProjection();
fromWgs84 = wgs84.getTransformation(projection);
} else {
toWgs84 = null;
fromWgs84 = null;
}
}
示例15: expandBoundingBox
import mil.nga.geopackage.projection.ProjectionConstants; //导入依赖的package包/类
/**
* Expand the bounding box by the LatLng
*
* @param boundingBox
* @param latLng
*/
private void expandBoundingBox(BoundingBox boundingBox, LatLng latLng) {
double latitude = latLng.latitude;
double longitude = latLng.longitude;
if (boundingBox.getMinLongitude() <= 3 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH && boundingBox.getMaxLongitude() >= 3 * -ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) {
if (longitude < boundingBox.getMinLongitude()) {
if (boundingBox.getMinLongitude()
- longitude > (longitude + (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)) - boundingBox.getMaxLongitude()) {
longitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH);
}
} else if (longitude > boundingBox.getMaxLongitude()) {
if (longitude - boundingBox.getMaxLongitude() > boundingBox.getMinLongitude()
- (longitude - (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH))) {
longitude -= (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH);
}
}
}
if (latitude < boundingBox.getMinLatitude()) {
boundingBox.setMinLatitude(latitude);
}
if (latitude > boundingBox.getMaxLatitude()) {
boundingBox.setMaxLatitude(latitude);
}
if (longitude < boundingBox.getMinLongitude()) {
boundingBox.setMinLongitude(longitude);
}
if (longitude > boundingBox.getMaxLongitude()) {
boundingBox.setMaxLongitude(longitude);
}
}