API Docs for: 7.2
Show:

MQA.MercatorGlobalProjection Class

Module: MQA

Spherical Mercator Projection. See http://en.wikipedia.org/wiki/Mercator_projection for details.

Methods

forward

(
  • lnglat
)
Array

Project an input longitude/latitude (in degrees) to an easting/northing pair in meters.

There are several formulas for this. See PROJ4, PROJ4JS, or other sources.

Map Projections, a Working Manual (USGS Professional Paper 1395) gives the following: x = R (lon - lon0) y = R ln tan ((pi / 4) + (lat / 2)) ...or y = (R/2) [ln ((1 + sin(lat)) / (1 - sin(lat))] And if lon/lat are in degrees: x = PI R (lon - lon0) / 180 y = R ln tan (45 + (lat / 2))

Parameters:

Returns <Array>

xy

inverse

(
  • xy
)
Array

Return the longitude/latitude (in degrees) which correspond to a given easting/northing (in meters) pair.

Parameters:

Returns <Array>

xy

mapTo180

(
  • val
)
Number

Maps a longitude to the range [-180.0, 180.0] as appropriate. Since maps are scrollable east/west infinitely, we need to handle the wrap around.

Parameters:

Returns <Number>