Skip to content

Commit 18cd81d

Browse files
committed
Merge pull request #7 from ngageoint/develop
get a tile grid from a single point at a zoom level
2 parents 5417c1e + cf51234 commit 18cd81d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,40 @@ public static BoundingBox getProjectedBoundingBox(Projection projection,
336336
return boundingBox;
337337
}
338338

339+
/**
340+
* Get the tile grid for the location specified as WGS84
341+
*
342+
* @param point
343+
* @param zoom
344+
* @return tile grid
345+
* @since 1.1.0
346+
*/
347+
public static TileGrid getTileGridFromWGS84(Point point, int zoom) {
348+
Projection projection = ProjectionFactory
349+
.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
350+
return getTileGrid(point, zoom, projection);
351+
}
352+
353+
/**
354+
* Get the tile grid for the location specified as the projection
355+
*
356+
* @param point
357+
* @param zoom
358+
* @param projection
359+
* @return tile grid
360+
* @since 1.1.0
361+
*/
362+
public static TileGrid getTileGrid(Point point, int zoom,
363+
Projection projection) {
364+
ProjectionTransform toWebMercator = projection
365+
.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
366+
Point webMercatorPoint = toWebMercator.transform(point);
367+
BoundingBox boundingBox = new BoundingBox(webMercatorPoint.getX(),
368+
webMercatorPoint.getX(), webMercatorPoint.getY(),
369+
webMercatorPoint.getY());
370+
return getTileGrid(boundingBox, zoom);
371+
}
372+
339373
/**
340374
* Get the tile grid that includes the entire tile bounding box
341375
*

0 commit comments

Comments
 (0)