WebMercatorQuad class
"Web Mercator Quad" tile matrix set.
OGC Two Dimensional Tile Matrix Set: "Level 0 allows representing most of the world (limited to latitudes between approximately ±85 degrees) in a single tile of 256x256 pixels (Mercator projection cannot cover the whole world because mathematically the poles are at infinity). The next level represents most of the world in 2x2 tiles of 256x256 pixels and so on in powers of 2. Mercator projection distorts the pixel size closer to the poles. The pixel sizes provided here are only valid next to the equator."
Using "Web Mercator Quad" involves following coordinates:
- position: geographic coordinates (longitude, latitude)
- world: a position projected to the pixel space of the map at level 0
- pixel: pixel coordinates (x, y) in the pixel space of the map at zoom
- tile: tile coordinates (x, y) in the tile matrix at zoom
The web mercator projection is often used to project geographic coordinates to metric projected coordinates, with x and y value range of (-20037508.34, 20037508.34). However this tile matrix implementation converts directly between geographic coordinates and world / pixel / tile coordinates.
Coordinate value ranges for the world covered by the tile matrix set (when tile size is 256 pixels):
- position / longitude: (-180.0°, 180.0°)
- position / latitude: (-85.051129°, 85.051129°)
- world / x and y: (0.0, 256.0)
- pixel at level 0 / x and y: (0, 255)
- pixel at level 2 / x and y: (0, 1023)
- tile at level 0 / x and y: (0, 0)
- tile at level 2 / x and y: (0, 3)
Tile coordinates at level 0 (one tile covering the world between latitudes -85.051129° and 85.051129°):
| 0,0 |
Tile coordinates at level 1 (tile matrix width is 2 and height is 2):
| 0,0 | 1,0 |
| 0,1 | 1,1 |
Tile coordinates at level 2 (tile matrix width is 4 and height is 4):
| 0,0 | 1,0 | 2,0 | 3,0 |
| 0,1 | 1,1 | 2,1 | 3,1 |
| 0,2 | 1,2 | 2,2 | 3,2 |
| 0,3 | 1,3 | 2,3 | 3,3 |
Each tile contains 256 x 256 pixels when the tile size is 256. As for level 2 there are 4 x 4 tiles, then the map canvas size is 1024 x 1024 pixels for that level. If the tile size is 512, then the map canvas size is 2048 x 2048 pixels.
Examples above uses "top-left" origin for world, pixel and tile coordinates. If "bottom-left" origin is used then y coordinates must be flipped, for example zoom level 1:
| 0,1 | 1,1 |
| 0,0 | 1,0 |
More information: https://en.wikipedia.org/wiki/Web_Mercator_projection https://developers.google.com/maps/documentation/javascript/coordinates https://docs.microsoft.com/en-us/bingmaps/articles/bing-maps-tile-system https://docs.opengeospatial.org/is/17-083r2/17-083r2.html
- Inheritance
-
- Object
- TileMatrixSet
- GeoTileMatrixSet
- WebMercatorQuad
- Annotations
-
- @immutable
Constructors
- WebMercatorQuad.epsg3857({int maxZoom = 22, int tileSize = 256, CanvasOrigin origin = CanvasOrigin.topLeft})
-
Create "Web Mercator Quad" tile matrix set with tileSize and origin.
const
Properties
- converter → ScaledConverter
-
A map converter between geospatial positions and map coordinates.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxZoom → int
-
The maximum (suggested) zoom level for this tile matrix set.
final
- origin → CanvasOrigin
-
The position of the origin in a tile matrix and map pixel "canvas".
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tileSize → int
-
The number of pixels for one tile in one axis (normally 256 or 512).
final
Methods
-
mapBounds(
) → GeoBox -
Returns a bounding box with min and max positions for the whole map.
inherited
-
mapHeight(
int zoom) → int -
The number of pixels ("map height") at
zoom
in the Y axis.override -
mapSize(
int zoom) → int -
The number of pixels at
zoom
(level of detail) in one axis. -
mapWidth(
int zoom) → int -
The number of pixels ("map width") at
zoom
in the X axis.override -
matrixHeight(
int zoom) → int -
The number of tiles ("matrix height") at
zoom
in the Y axis.override -
matrixSize(
int zoom) → int -
The number of tiles at
zoom
(level of detail) in one axis. -
matrixWidth(
int zoom) → int -
The number of tiles ("matrix width") at
zoom
in the X axis.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pixelArcResolution(
int zoom) → double -
The arc resolution (longitudal) of a pixel in degrees at
zoom
.inherited -
pixelGroundResolution(
int zoom) → double -
The pixel ground resolution in meters at
zoom
.override -
pixelGroundResolutionAt(
{required double latitude, required int zoom}) → double -
The pixel ground resolution in meters at given
latitude
andzoom
. -
pixelToPosition(
Scalable2i pixel) → Geographic -
Transforms
pixel
coordinates to a position.inherited -
pixelToTile(
Scalable2i pixel) → Scalable2i -
Returns a tile covering a region in
pixel
coordinates.inherited -
pixelToWorld(
Scalable2i pixel) → Projected -
Transforms
pixel
coordinates to world coordinates.inherited -
positionToPixel(
covariant Position position, {int zoom = 0}) → Scalable2i -
Transforms
position
to pixel coordinates atzoom
.inherited -
positionToTile(
covariant Position position, {int zoom = 0}) → Scalable2i -
Returns a tile at
zoom
covering a region inposition
.inherited -
positionToWorld(
covariant Position position) → Projected -
Transforms
position
to world coordinates.inherited -
quadKeyToTile(
String quadKey) → Scalable2i -
Returns a tile identified by
quadKey
(as specified by Microsoft). -
scaleDenominator(
int zoom, {double screenPPI = screenPPIbyOGC}) → double -
The map scale denominator at
zoom
andscreenPPI
.override -
scaleDenominatorAt(
{required double latitude, required int zoom, double screenPPI = screenPPIbyOGC}) → double -
The map scale denominator at given
latitude
,zoom
andscreenPPI
. -
tileArcResolution(
int zoom) → double -
The arc resolution (longitudal) of a tile in degrees at
zoom
.inherited -
tileGroundResolution(
int zoom) → double -
The tile ground resolution in meters at
zoom
.override -
tileToBounds(
Scalable2i tile) → GeoBox -
Returns a bounding box with min and max positions for
tile
.inherited -
tileToPixel(
Scalable2i tile, {Aligned align = Aligned.center, bool requireInside = false}) → Scalable2i -
Transforms a fractional point defined by
align
insidetile
to pixel coordinates.inherited -
tileToPosition(
Scalable2i tile, {Aligned align = Aligned.center}) → Geographic -
Transforms a fractional point defined by
align
insidetile
to a position.inherited -
tileToQuadKey(
Scalable2i tile) → String -
Returns the quad key (as specified by Microsoft) for
tile
. -
tileToWorld(
Scalable2i tile, {Aligned align = Aligned.center}) → Projected -
Transforms a fractional point defined by
align
insidetile
to world coordinates.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
worldToPixel(
Projected world, {int zoom = 0}) → Scalable2i -
Transforms
world
coordinates to pixel coordinates atzoom
.inherited -
worldToPosition(
Projected world) → Geographic -
Transforms
world
coordinates to a position.inherited -
worldToTile(
Projected world, {int zoom = 0}) → Scalable2i -
Returns a tile at
zoom
covering a region inworld
coordinates.inherited -
zoomFromPixelGroundResolution(
double resolution) → double -
The zoom from pixel ground
resolution
in meters.override -
zoomFromPixelGroundResolutionAt(
{required double latitude, required double resolution}) → double -
The zoom from pixel ground
resolution
in meters at givenlatitude
. -
zoomFromScaleDenominator(
double denominator, {double screenPPI = screenPPIbyOGC}) → double -
The zoom from map scale
denominator
at givenscreenPPI
.override -
zoomFromScaleDenominatorAt(
{required double latitude, required double denominator, double screenPPI = screenPPIbyOGC}) → double -
The zoom from map scale
denominator
at givenlatitude
andscreenPPI
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited