gzd-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

GZD Utils for Nodejs

travis codecov npm size license

Utilities for calculating MGRS GZDs in Nodejs.

Installation

$ npm install gzd-utils

Usage

import { Polygon } from 'geojson';
import { getAllGZD, getGZD } from 'gzd-utils';

// Get all GZDs
const gzdZones = getAllGZD();
gzdZones.features.forEach((zone) => {
  console.log(`Zone: ${zone.properties['name']}`);
  const polygon = zone.geometry as Polygon;
  console.log(`Coordinates: ${polygon.coordinates}`);
};

// Get a specific GZD
let zone = getGZD('33V');
console.log(`Zone: ${zone.properties['name']}`);
let polygon = zone.geometry as Polygon;
console.log(`Coordinates: ${polygon.coordinates}`);

// Alternate way of getting a specific GZD
zone = getGZD(33, 'V');
console.log(`Zone: ${zone.properties['name']}`);
polygon = zone.geometry as Polygon;
console.log(`Coordinates: ${polygon.coordinates}`);

Readme

Keywords

Package Sidebar

Install

npm i gzd-utils

Weekly Downloads

6

Version

1.0.3

License

ISC

Unpacked Size

9.47 kB

Total Files

5

Last publish

Collaborators

  • gustavlarson