{"id":13001,"library":"coordinate-parser","title":"Coordinate Parser","description":"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.","status":"abandoned","version":"1.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/otto-dev/coordinate-parser","tags":["javascript"],"install":[{"cmd":"npm install coordinate-parser","lang":"bash","label":"npm"},{"cmd":"yarn add coordinate-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add coordinate-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a CommonJS module. Direct ES module `import` syntax will fail without a transpiler or CJS interop layer, as there is no `default` export for ESM and no named exports.","wrong":"import Coordinates from 'coordinate-parser';\nimport { Coordinates } from 'coordinate-parser';","symbol":"Coordinates","correct":"const Coordinates = require('coordinate-parser');"}],"quickstart":{"code":"const Coordinates = require('coordinate-parser');\n\ntry {\n  // Parsing a standard Degrees-Minutes-Seconds (DMS) coordinate string\n  const position1 = new Coordinates('40° 7´ 22.8\" N 74° 7´ 22.8\" W');\n  console.log(`Latitude (DMS): ${position1.getLatitude()}`);\n  console.log(`Longitude (DMS): ${position1.getLongitude()}`);\n\n  // Parsing a Decimal Degrees (DD) string\n  const position2 = new Coordinates('40.123, -74.123');\n  console.log(`Latitude (DD): ${position2.getLatitude()}`);\n  console.log(`Longitude (DD): ${position2.getLongitude()}`);\n\n  // Example of using the built-in validation via try-catch\n  const isValidPosition = function(input) {\n    try {\n      new Coordinates(input);\n      return true;\n    } catch (error) {\n      console.error(`Validation error for \"${input}\": ${error.message}`);\n      return false;\n    }\n  };\n\n  console.log(`Is '40.123N 74.123W' valid? ${isValidPosition('40.123N 74.123W')}`);\n  console.log(`Is '40.123 FOOBAR! 74.123' valid? ${isValidPosition('40.123 FOOBAR! 74.123')}`);\n\n} catch (e) {\n  console.error(\"An unexpected error occurred during quickstart execution:\", e);\n}","lang":"javascript","description":"This quickstart demonstrates parsing various coordinate formats (DMS, DD) and using the built-in validation mechanism to check input validity."},"warnings":[{"fix":"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.","message":"The `coordinate-parser` package is effectively abandoned. Its last update was in June 2017. This means there will be no further bug fixes, new features, or security patches, making it potentially vulnerable or incompatible with newer Node.js versions or evolving JavaScript ecosystems.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"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.","message":"Strict input validation: The parser aggressively validates input strings, throwing an `Error` for any string that does not precisely conform to a recognized coordinate format. This includes malformed syntax, unknown characters, or swapped latitude/longitude components.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"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(...))`.","message":"CommonJS only: The package is published exclusively as a CommonJS module. It does not natively support ES Modules (`import/export`) without a transpiler or Node.js's CJS-ESM interop layer. Direct `import` statements in pure ESM environments will likely result in runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Change the import statement to `const Coordinates = require('coordinate-parser');`.","cause":"Attempting to use ES module `import` syntax (e.g., `import { Coordinates } from 'coordinate-parser';` or `import Coordinates from 'coordinate-parser';`) with this CommonJS-only package.","error":"TypeError: Coordinates is not a constructor"},{"fix":"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.","cause":"The string passed to the `Coordinates` constructor does not match any of the library's recognized geographical coordinate patterns, contains invalid characters, or has an incorrect structure.","error":"Error: Input does not resemble a valid coordinate format"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}