1.0.3 • Published 3 years ago

gzd-utils v1.0.3

Weekly downloads
41
License
ISC
Repository
github
Last release
3 years ago

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}`);
1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago