1.1.3 • Published 5 years ago

parse-coords v1.1.3

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

parse-coords

Parse DD, DDM, DMS or UTM coordinates into a {lat, long}

Installing

npm install --save parse-coords

Example

import coordinates from 'parse-coords'

coordinates('41.40338, 2.17403') // {lat: 41.40338, lng: 2.17403}

coordinates(`41°24'12.2"N 2°10'26.5"E`) // {lat: 41.40339, lng: 2.17403}

coordinates('31T 430959.5858286716 4583866.770942634') // {lat: 41.40338, lng: 2.17403}

coordinates('foo N bar S') // null

Input sanitation

The library makes the best effort to understand the input. Where makes sense:

  • commas are optional
  • spaces are optional
  • degree, minute, second symbols are optional

API

coordinates(string)

Parameters

string - represents the coordinates in one of the formats - DD, DDM, DMS or UTM

Returns

{lat, lng} - an object containing lat and lng fields, represented in Decimal Degrees format.

Handling Errors

If the string passed in is in an unrecognized format, null is returned.

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

6 years ago

0.1.1

8 years ago

0.1.0

8 years ago