MercatorProjection class

Web Mercator projection implementation for converting between geographic and tile coordinates.

This class implements the standard Web Mercator projection (EPSG:3857) used by most web mapping services. It provides conversions between:

  • Geographic coordinates (latitude/longitude) and tile coordinates (tileX/tileY)
  • Support for different zoom levels with scalefactor-based calculations
  • Boundary box calculations for tiles and tile ranges

Key features:

  • Efficient tile coordinate calculations
  • Proper handling of world boundaries and edge cases
  • Cached scalefactor for performance
  • Dateline crossing fixes for boundary calculations
Implemented types
Implementers

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scalefactor → Scalefactor
no setter

Methods

boundingBoxOfTile(Tile tile) → BoundingBox
Calculates the geographic bounding box for a single tile.
boundingBoxOfTileNumbers(int top, int left, int bottom, int right) → BoundingBox
boundingBoxOfTiles(Tile upperLeft, Tile lowerRight) → BoundingBox
latitudeToTileY(double latitude) → int
Converts a latitude coordinate to the corresponding tile Y number.
override
longitudeToTileX(double longitude) → int
@param scaleFactor the scale factor for which the size of the world map should be returned. @return the horizontal and vertical size of the map in pixel at the given scale. @throws IllegalArgumentException if the given scale factor is < 1 Converts a longitude coordinate to the corresponding tile X number.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
tileXToLongitude(int tileX) → double
Converts a tile X coordinate to the corresponding longitude (western edge).
override
tileYToLatitude(int tileY) → double
Converts a tile Y coordinate to the corresponding latitude (northern edge).
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited