mercatorProject
Chart
stable
Projects WGS-84 geographic coordinates (longitude / latitude) into SVG pixel space using the Web Mercator (EPSG:3857) formula. Reference canvas: 1000 × 500 px.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- lngrequirednumber
- Longitude in degrees, range [-180, 180].
- latrequirednumber
- Latitude in degrees, clamped to [-85, 85] to avoid Mercator divergence at the poles.
- widthnumber1000
- SVG canvas width in pixels.
- heightnumber500
- SVG canvas height in pixels.
API
Return value
The value returned by this util.
- [x, y] pixel coordinates in SVG space, rounded to one decimal place.
Usage
Examples
Ready-to-paste usage snippets.
Project Paris onto a 1000×500 SVG canvas