@yandex/ymaps3-types
Version:
Types for ymaps3 maps library
47 lines (46 loc) • 1.32 kB
TypeScript
import type { Projection, LngLat, WorldCoordinates } from "../../common/types";
/**
* @private
* Mercator projection onto a sphere.
* Used by many mapping services, in particular OpenStreetMap
*
* ```js
* // Create a map in the web Mercator projection
* const map = new ymaps3.YMap(document.getElementById('YMapsID'), {
* location: {
* center: [37, 55],
* zoom: 6
* },
* projection: new WebMercator()
* });
* const dataSourceProps = {
* raster: {
* type: 'ground',
* fetchTile: "https://tile.openstreetmap.org/{{z}}/{{y}}/{{x}}"
* }
* };
* // Add osm tiles
* const dataSource = new ymaps3.YMapTileDataSource({
* id: "osmSource",
* ...dataSourceProps,
* });
*
* const layer = new ymaps3.YMapLayer({
* id: "osm",
* source: "osmSource",
* type: "ground",
* });
* ```
*/
export declare class WebMercator implements Projection {
private _maxLatitudeRad;
type: string;
toWorldCoordinates(coords: LngLat): WorldCoordinates;
fromWorldCoordinates(world: WorldCoordinates): LngLat;
private _worldXToLongitude;
private _longitudeToWorldX;
private _latitudeToWorldY;
private _worldYToLatitude;
}
/** @deprecated Use WebMercator instead */
export declare const SphericalMercator: typeof WebMercator;