Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@yandex/ymaps3-cartesian-projection
Advanced tools
Yandex Maps JS API 3.0 example @yandex/ymaps3-cartesian-projection
Yandex JS API package
This package will project your cartesian dimensions to Yandex JS API world representation (see scheme of work below). Then you can use it as YMap
location
property, in YMapListener
handlers, etc.
You can install this package via npm:
npm install --save @yandex/ymaps3-cartesian-projection
To use Cartesian projection, just import it:
import {Cartesian} from '@yandex/ymaps3-cartesian-projection';
const projection = new Cartesian([
// these boundaries define the limits of the world map in the Cartesian coordinate system.
[-400, -600],
[400, 600],
]);
console.log(projection.toWorldCoordinates([-400, 600])) // {x: -1, y: 1}
console.log(projection.toWorldCoordinates([200, 0])) // {x: 0.5, y: 0}
console.log(projection.toWorldCoordinates([0, -75])) // {x: 0, y: -0.125}
console.log(projection.fromWorldCoordinates({x: -1, y: 1})) // [-400, 600]
console.log(projection.fromWorldCoordinates({x: 0.5, y: 0})) // [200, 0]
console.log(projection.fromWorldCoordinates({x: 0, y: -0.125})) // [0, -75]
You can use some CDN with ymaps3.import
JS API module loading handler on your page:
const pkg = await ymaps3.import('@yandex/ymaps3-cartesian-projection');
NOTE:
By default ymaps3.import
can load self modules, scripts or style.
To make the code above work, you should add a loader:
// Add loader at the beginning of the loader queue
ymaps3.import.loaders.unshift(async (pkg) => {
// Process only this package
if (!pkg.includes('@yandex/ymaps3-cartesian-projection')) return;
// Load script directly. You can use another CDN
await ymaps3.import.script(`https://unpkg.com/${pkg}/dist/index.js`);
// Return result object
return window['@yandex/ymaps3-cartesian-projection'];
});
FAQs
Yandex Maps JS API 3.0 example @yandex/ymaps3-cartesian-projection
The npm package @yandex/ymaps3-cartesian-projection receives a total of 33 weekly downloads. As such, @yandex/ymaps3-cartesian-projection popularity was classified as not popular.
We found that @yandex/ymaps3-cartesian-projection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.