class

SphericalMercator

Inherits Reference < Object

Constants

A = 6378137.0

900913 properties.

D2R = Math::PI / 180
DEFAULT_SIZE = 256.as(Int32)
MAXEXTENT = 20037508.342789244
R2D = 180 / Math::PI
VERSION = "0.1.0"

Constructors

new(size : Int32 = DEFAULT_SIZE)
Source

Instance methods

bbox(x, y, zoom, tms_style = false, srs = "WGS84")

Convert tile xyz value to bbox of the form [w, s, e, n]

  • x {Number} x (longitude) number.
  • y {Number} y (latitude) number.
  • zoom {Number} zoom.
  • tms_style {Boolean} whether to compute using tms-style.
  • srs {String} projection for resulting bbox (WGS84|900913).
  • return {Array} bbox array of values in form [w, s, e, n].
Source
convert(bbox, to = "WGS84")

Convert projection of given bbox.

  • bbox {Number} bbox in the form [w, s, e, n].
  • to {String} projection of output bbox (WGS84|900913). Input bbox assumed to be the "other" projection.
  • @return {Object} bbox with reprojected coordinates.
Source
forward(ll)

Convert lon/lat values to 900913 x/y.

Source
inverse(xy)

Convert 900913 x/y values to lon/lat.

Source
ll(px, zoom)

Convert screen pixel value to lon lat

  • px {Array} [x, y] array of geographic coordinates.
  • zoom {Number} zoom level.
Source
px(ll, zoom)
Source
xyz(bbox, zoom, tms_style = false, srs = "WGS84")

Convert bbox to xyx bounds

  • bbox {Number} bbox in the form [w, s, e, n].
  • zoom {Number} zoom.
  • tms_style {Boolean} whether to compute using tms-style.
  • srs {String} projection of input bbox (WGS84|900913).
  • @return {Object} XYZ bounds containing minX, maxX, minY, maxY properties.
Source