Module sphericalMercator

Index

Functions

Functions

deprojectToLatLon(mapPt: point): point

Project a point from Spherical Mercator to latitude/longitude.

Parameters

  • mapPt: point

    Point object in Spherical Mercator.

Returns

point

The same point in latitude/longitude.

getActualShapeScaleTransform(mapPtY: number): number

Gets the required scale transform to apply to shapes so distance and area computations yield actual Earth-geodesic units instead of projected map units.

Parameters

  • mapPtY: number

    Reference latitude for the computation.

Returns

number

Scale transform multiplier.

getActualUnitsPerPixel(mapPt: point, zoomLevel: number): number

Gets actual, on-the-ground meters per pixel for a given zoom level and map point in map units.

Parameters

  • mapPt: point

    Reference location for the computation.

  • zoomLevel: number

Returns

number

Meters per pixel multiplier.

getBestFitZoomLevelByExtents(envelopeMap: envelope, envelopeDevice: envelope): number

Gets the optimal zoom level for a given envelope in map units based on the envelope of visible device area in pixels.

Parameters

  • envelopeMap: envelope

    Envelope in map units to display.

  • envelopeDevice: envelope

    Envelope in pixels of visible area.

Returns

number

Optimal zoom level for viewing envelopeMap.

getCircumference(): number

Returns equitorial circumference in meters for this projection

Returns

number

Equitorial circumference in meters.

getDpi(): number

Gets the display DPI, which defaults to 96. Note: The dpi is recomputed on page load complete.

Returns

number

Dots per inch on display.

getEpsg(): number

Gets the EPSG number for Spherical Mercator.

Returns

number

ESPG number.

getHalfCircumference(): number

Returns half the equitorial circumference in meters for this projection

Returns

number

Half of the equitorial circumference in meters.

getMaxZoomLevel(): number

Gets the maxmimum zoom level for this projection.

Returns

number

Maximum zoom level.

getMinZoomLevel(): number

Gets the minimum zoom level for this projection.

Returns

number

Minimum zoom level.

getProjectionUnitsPerPixel(zoomLevel: number): number

Gets projected map units per pixel for a given zoom level.

Parameters

  • zoomLevel: number

    Reference zoom level.

Returns

number

Projection units per pixel.

getQuadKeyFromXYZ(x: number, y: number, z: number): string

Gets a quad-key from x, y, and z coordinates.

Parameters

  • x: number

    The x coordinate.

  • y: number

    The y coordinate.

  • z: number

    The z coordinate.

Returns

string

Quad-key string.

getQuadTreeNodeRangeFromEnvelope(env: envelope, z: number): envelope

Gets the envelope in map units of tiles in the quadtree from an evelope in map units and a zoom level.

Parameters

  • env: envelope

    Envelope for which to find intersecting tiles.

  • z: number

    Zoom level with which to test for intersection.

Returns

envelope

The envelope in map units of the tiles.

getQuadTreeNodeToMapEnvelope(x: number, y: number, z: number): envelope

Get the envelope in map units for a given quadtree node, i.e. tile, based on the given x, y, and z quadtree coordinates.

Parameters

  • x: number

    The x coordinate.

  • y: number

    The y coordinate.

  • z: number

    The z coordinate.

Returns

envelope

Envelope of the tile in map units.

getRadius(): number

Return the equitorial radius in meters for this projection.

Returns

number

Equitorial radius in meters.

getTileSizePix(): number

Gets the tile height and width in pixels.

Returns

number

The height and width of the tiles in pixels.

getXYZFromQuadKey(key: string): { x: number; y: number; z: number; }

Gets x, y, and z coordinates as an object from a given quad-key.

Parameters

  • key: string

    Reference quad-key.

Returns

{ x: number; y: number; z: number; }

JavaScript object of the form {x,y,z}.

projectFromLatLon(lonLat: point): point

Project a point from latitude/longitude to Spherical Mercator.

Parameters

  • lonLat: point

    Point object in latitude/longitude.

Returns

point

The same point in Spherical Mercator.

setDpi(dpi: number)

Set the display DPI, which defaults to 96. Note: The DPI is recomputed on page load complete.

Parameters

  • dpi: number

    Dots per inch on display.

setMaxZoomLevel(maxZ: number)

Sets the maximum zoom level for this projection. Normally this is set to 20.0 and should not be altered.

Parameters

  • maxZ: number

setMinZoomLevel(minZ: number)

Sets the minimum zoom level for this projection. Normally this is set to 1.0 and should not be altered.

Parameters

  • minZ: number

    Desired minimum zoom level.