🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@yandex/ymaps3-world-utils

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yandex/ymaps3-world-utils

Yandex Maps 3 World Utilities - coordinate transformation functions

latest
npmnpm
Version
0.0.18255542
Version published
Weekly downloads
1.7K
90.15%
Maintainers
2
Weekly downloads
 
Created
Source

@yandex/ymaps3-world-utils

Utility package for coordinate transformations in Yandex Maps 3.0.

Usage

ES Modules

npm install @yandex/ymaps3-world-utils
import { worldToPixels, pixelsToWorld } from '@yandex/ymaps3-world-utils';

// Convert world coordinates to pixels
const pixels = worldToPixels({ x: 0.5, y: 0.5 }, 10);
console.log(pixels); // { x: 196608, y: 65536 }

// Convert pixels back to world coordinates
const world = pixelsToWorld({ x: 196608, y: 65536 }, 10);
console.log(world); // { x: 0.5, y: 0.5 }

API Reference

Coordinate Systems

The package works with two coordinate systems:

  • WorldCoordinates - Normalized coordinates in the range [-1, 1]

    • Center: (0, 0)
    • Bottom-left corner: (-1, -1)
    • Top-right corner: (1, 1)
  • PixelCoordinates - Global pixel coordinates

    • World size depends on zoom level: 2^(zoom + 8) × 2^(zoom + 8) pixels
    • At zoom 0: 256×256 pixels
    • At zoom 10: 262,144×262,144 pixels
    • Top-left corner: (0, 0)
    • Bottom-right corner: (2^(zoom + 8), 2^(zoom + 8))

Functions

worldToPixels(coordinates: WorldCoordinates, zoom: number): PixelCoordinates

Converts world coordinates to pixel coordinates.

Parameters:

  • coordinates - World coordinates object with x and y properties
  • zoom - Zoom level (integer)

Returns: Pixel coordinates object with x and y properties

Example:

const pixels = worldToPixels({ x: 0, y: 0 }, 10);
// Returns: { x: 131072, y: 131072 } - center of the world at zoom 10

pixelsToWorld(pixels: PixelCoordinates, zoom: number): WorldCoordinates

Converts pixel coordinates to world coordinates.

Parameters:

  • pixels - Pixel coordinates object with x and y properties
  • zoom - Zoom level (integer)

Returns: World coordinates object with x and y properties

Example:

const world = pixelsToWorld({ x: 131072, y: 131072 }, 10);
// Returns: { x: 0, y: 0 } - center of the world

License

Apache-2.0

Keywords

ymaps3

FAQs

Package last updated on 10 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts