Socket
Socket
Sign inDemoInstall

mgrs

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mgrs

Utility for converting between WGS84 lat/lng and MGRS coordinates


Version published
Weekly downloads
218K
increased by1.01%
Maintainers
2
Weekly downloads
 
Created

What is mgrs?

The 'mgrs' npm package provides functionality for converting between latitude/longitude coordinates and Military Grid Reference System (MGRS) coordinates. It is useful for applications that require precise location data in a standardized grid format.

What are mgrs's main functionalities?

Convert Lat/Lon to MGRS

This feature allows you to convert latitude and longitude coordinates to MGRS coordinates. The code sample demonstrates converting the coordinates of Los Angeles (34.0522, -118.2437) to an MGRS string.

const mgrs = require('mgrs');
const latLon = [34.0522, -118.2437];
const mgrsCoord = mgrs.forward(latLon);
console.log(mgrsCoord); // Output: '11SLT7432279348'

Convert MGRS to Lat/Lon

This feature allows you to convert MGRS coordinates back to latitude and longitude. The code sample demonstrates converting the MGRS string '11SLT7432279348' back to the coordinates of Los Angeles.

const mgrs = require('mgrs');
const mgrsCoord = '11SLT7432279348';
const latLon = mgrs.toPoint(mgrsCoord);
console.log(latLon); // Output: [34.0522, -118.2437]

Convert UTM to MGRS

This feature allows you to convert UTM (Universal Transverse Mercator) coordinates to MGRS. The code sample demonstrates converting a UTM coordinate to an MGRS string.

const mgrs = require('mgrs');
const utmCoord = [500000, 4649776, 33];
const mgrsCoord = mgrs.UTMtoMGRS(utmCoord);
console.log(mgrsCoord); // Output: '33TWN0000000000'

Convert MGRS to UTM

This feature allows you to convert MGRS coordinates to UTM coordinates. The code sample demonstrates converting the MGRS string '33TWN0000000000' to a UTM coordinate.

const mgrs = require('mgrs');
const mgrsCoord = '33TWN0000000000';
const utmCoord = mgrs.MGRStoUTM(mgrsCoord);
console.log(utmCoord); // Output: [500000, 4649776, 33]

Other packages similar to mgrs

Keywords

FAQs

Package last updated on 25 Jan 2017

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc