当前位置: 首页>>代码示例>>Java>>正文


Java ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH属性代码示例

本文整理汇总了Java中mil.nga.geopackage.projection.ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH属性的典型用法代码示例。如果您正苦于以下问题:Java ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH属性的具体用法?Java ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH怎么用?Java ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在mil.nga.geopackage.projection.ProjectionConstants的用法示例。


在下文中一共展示了ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWebMercatorBoundingBox

/**
 * 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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:29,代码来源:TileBoundingBoxUtils.java

示例2: getTileGrid

/**
 * 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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:31,代码来源:TileBoundingBoxUtils.java

示例3: getZoomLevel

/**
 * 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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:24,代码来源:TileBoundingBoxUtils.java

示例4: zoomLevelOfTileSize

/**
 * Get the zoom level from the tile size in meters
 * 
 * @param tileSize
 *            tile size in meters
 * @return zoom level
 * @since 1.2.0
 */
public static double zoomLevelOfTileSize(double tileSize) {
	double tilesPerSide = (2 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH)
			/ tileSize;
	double zoom = Math.log(tilesPerSide) / Math.log(2);
	return zoom;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:14,代码来源:TileBoundingBoxUtils.java

示例5: tileSize

/**
 * Get the tile size in meters
 *
 * @param tilesPerSide
 *            tiles per side
 * @return tile size
 */
public static double tileSize(int tilesPerSide) {
	return (2 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH)
			/ tilesPerSide;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:11,代码来源:TileBoundingBoxUtils.java


注:本文中的mil.nga.geopackage.projection.ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。