Package dev.avelar.mapnik
Class Tiles
java.lang.Object
dev.avelar.mapnik.Tiles
Maths for the standard "slippy map" tile grid used by web maps (XYZ or Google scheme): zoom 0 is one
tile covering the world in Web Mercator (EPSG:3857), and each zoom splits every tile in four. Tile
(0, 0) is at the top left, so y grows downwards. Pure Java: no native library needed.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleThe latitude Web Mercator cuts off at.static final intThe highest zoom this class accepts.static final doubleHalf the width of the Web Mercator world, in metres. -
Method Summary
Modifier and TypeMethodDescriptionstatic Box2dbounds(int z, int x, int y) The area of tile (z, x, y) in Web Mercator metres.static List<Tiles.Tile>Every tile at a zoom that touches a box given in degrees, row by row from the top left.static Box2dlonLatBounds(int z, int x, int y) The area of tile (z, x, y) in degrees.static doubleresolution(int z, int tileSize) The size of one pixel, in metres, for tilestileSizepixels wide at a zoom.static Tiles.TiletileAt(double lon, double lat, int z) The tile containing a location at a zoom.
-
Field Details
-
ORIGIN_SHIFT
public static final double ORIGIN_SHIFTHalf the width of the Web Mercator world, in metres.- See Also:
-
MAX_ZOOM
public static final int MAX_ZOOMThe highest zoom this class accepts.- See Also:
-
MAX_LATITUDE
public static final double MAX_LATITUDEThe latitude Web Mercator cuts off at.- See Also:
-
-
Method Details
-
bounds
The area of tile (z, x, y) in Web Mercator metres. -
lonLatBounds
The area of tile (z, x, y) in degrees. -
tileAt
The tile containing a location at a zoom. Latitudes beyondMAX_LATITUDEcount as at the edge, and longitudes are clamped to the world. -
covering
Every tile at a zoom that touches a box given in degrees, row by row from the top left. -
resolution
public static double resolution(int z, int tileSize) The size of one pixel, in metres, for tilestileSizepixels wide at a zoom.
-