geographic-coordinate-converter

1.0.0 • Public • Published

Geographic Coordinate Format Converter

A library to transform geospatial coordinates.

Installation

To install the stable version:

npm install --save geographic-coordinate-converter

This assumes you are using npm as your package manager.

Usage

Instance the converter from one of the following methods:

import { CoordinateConverter } from "./coordinate-converter"; 
        
CoordinateConverter.fromDecimal(array)
CoordinateConverter.fromDecimal(string)
CoordinateConverter.fromDegreeMinutes(string)
CoordinateConverter.fromDegreeMinutesSeconds(string)

Convert to the desired format:

.toDecimalArray();
.toDecimal();
.toDegreeMinutes()
.toDegreeMinutesSeconds()

Examples

CoordinateConverter.fromDecimal([-36.01011, -2.34856])
    .toDegreeMinutes() //"36º 00.607' S 002º 20.914' W"
CoordinateConverter.fromDegreeMinutes("36º 00.607' S 002º 20.914' W")
    .toDegreeMinutesSeconds() //"36º 00' 36.4'' S 002º 20' 54.8'' W"
CoordinateConverter.fromDegreeMinutesSeconds("36º 00' 36.4'' S 002º 20' 54.8'' W")
    .toDecimal() //"-36.01011 -2.34856"
CoordinateConverter.fromDegreeMinutes("36º 00.607' S 002º 20.914' W")
    .toDecimalArray() //[-36.01012, -2.34857]

License

MIT

Package Sidebar

Install

npm i geographic-coordinate-converter

Weekly Downloads

8

Version

1.0.0

License

MIT

Unpacked Size

13 kB

Total Files

7

Last publish

Collaborators

  • javidalpe