The x component of the position.
The y component of the position.
The z component of the position.
Returns the distance of 1 meter in MercatorCoordinate units at this latitude.
For coordinates in real world units using meters, this naturally provides the scale
to transform into MercatorCoordinates.
Distance of 1 meter in MercatorCoordinate units.
Static fromProject a LngLat to a MercatorCoordinate.
The location to project.
The altitude in meters of the position.
The projected mercator coordinate.
let coord = MercatorCoordinate.fromLngLat({ lng: 0, lat: 0}, 0);
coord; // MercatorCoordinate(0.5, 0.5, 0)
A
MercatorCoordinateobject represents a projected three dimensional position.MercatorCoordinateuses the web mercator projection (EPSG:3857) with slightly different units:For example,
MercatorCoordinate(0, 0, 0)is the north-west corner of the mercator world andMercatorCoordinate(1, 1, 0)is the south-east corner. If you are familiar with vector tiles it may be helpful to think of the coordinate space as the0/0/0tile with an extent of1.The
zdimension ofMercatorCoordinateis conformal. A cube in the mercator coordinate space would be rendered as a cube.Example
See
Add a custom style layer