The `coordinate-parser` library provides a flexible algorithm for parsing strings that contain geographical coordinates in a wide variety of formats. It supports numerous representations including Decimal Degrees (DD), Degrees-Minutes-Seconds (DMS), Degrees-Decimal Minutes (DDM), and various 'exotic' formats like geographical milliseconds or compacted notations. The current stable version is 1.0.7, with the last release dating back to June 2017. As there have been no updates or maintenance activities since then, the package is effectively abandoned. A key differentiator is its robust input validation, which throws an error for any string that does not precisely conform to a recognized coordinate pattern, ensuring data integrity. It aims to simplify the extraction of latitude and longitude from complex user inputs into standardized decimal degree values.
npm install coordinate-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates parsing various coordinate formats (DMS, DD) and using the built-in validation mechanism to check input validity.
Thoroughly audit the package's source code before use. For new projects or critical applications, consider migrating to a more actively maintained library for geographical coordinate parsing, or prepare to fork and maintain the code yourself.
Always wrap calls to `new Coordinates(inputString)` in a `try...catch` block to gracefully handle invalid user input or unexpected formats. Implement custom pre-validation if specific input patterns are expected.
Use `const Coordinates = require('coordinate-parser');` in Node.js environments. For browser use or pure ESM projects, ensure your build pipeline (e.g., Webpack, Rollup) is configured to handle CommonJS modules, or consider using dynamic `import('coordinate-parser').then(module => new module.Coordinates(...))`.Change the import statement to `const Coordinates = require('coordinate-parser');`.Review the input string for typos or incorrect formatting. Ensure it strictly adheres to one of the supported formats. Implement a `try...catch` block around the constructor call to handle invalid inputs gracefully, as demonstrated in the quickstart.
No dependency data recorded yet.