Socket
Socket
Sign inDemoInstall

mercator-projection

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mercator-projection

Translate latitude and longitude values into 'world' coordinates as used by the Google Map API.


Version published
Weekly downloads
824
increased by8.71%
Maintainers
1
Install size
6.36 kB
Created
Weekly downloads
 

Readme

Source

mercator-projection

Whenever the Google Maps API needs to translate a location in the world to a location on a map (the screen), it needs to first translate latitude and longitude values into a "world" coordinate. This translation is accomplished using the Mercator projection.

More details can be found here.

Ported from here.

Installation

$ npm install -g mercator-projection

Examples

The following examples show you how to use mercator-projection.

var merc = require('mercator-projection');

// translate a latlng to a xy
var xy = merc.fromLatLngToPoint({lat: -27.470127, lng: 153.0147027});
// {x: 236.81045525333332, y: 148.32879785796487}

// translate a xy to a latlng
var ll = merc.fromPointToLatLng({x: 236.81045525333332, y: 148.32879785796487})
// ~ {lat: -27.470127, lng: 153.0147027}

Running tests

$ npm test

Keywords

FAQs

Last updated on 13 Jun 2014

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