Socket
Socket
Sign inDemoInstall

latlon_to_xy

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    latlon_to_xy

Converts Web Mercator coordinates to screen pixels and back


Version published
Maintainers
1
Install size
5.07 kB
Created

Readme

Source

latlon_to_xy

Converts Web Mercator coordinates to screen pixels and back

  • Used for creating the SRT log viewer in https://djitelemetryoverlay.com/

Installation

Using npm:

$ npm install latlon_to_xy

Usage

//Load module
let conversions = require('latlon_to_xy');

//set values
conversions.setupConversor(
  tile_height,
  zoom,
  center_longitude,
  center_latitude
);

//once the values are set, only one value is required for all calculations, and an alternative center value is optional
let x = conversions.lonToX(lon, altC); //converts longitude to x, an alternative center can be provided in lon units
let y = conversions.latToY(lat, altC); //converts latitude to y, an alternative center can be provided in lat units
let lon = conversions.xToLon(x, altC); //converts x to longitude, an alternative center can be provided in lon units
let lat = conversions.yToLat(y, altC); //converts y to latitude, an alternative center can be provided in lat units

TODO

  • Provide method for calculating necessary zoom for a location to be inside the screen

Keywords

FAQs

Last updated on 18 Nov 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc