The `wkt-parser` library provides robust parsing capabilities for Well-Known Text (WKT) and PROJJSON strings, designed specifically for geographic and geodetic data. Originating as a standalone component extracted from the `proj4js` library, it aims to offer a dedicated and hackable solution for WKT and PROJJSON interpretation. It supports both WKT1 and the more advanced WKT2 standards, alongside PROJJSON, a JSON representation for coordinate operation definitions. The current stable version is 1.5.5, with frequent updates indicated by its recent publish history. A key differentiator is its comprehensive support for multiple WKT standards and PROJJSON, making it versatile for applications dealing with various geospatial data formats. However, it explicitly notes limitations: it does not support geocentric coordinate systems (`GEOCCS`) and `COMPOUNDCS` is only partially supported for WKT1. This focus makes it a specialized tool for developers working with projection and coordinate system definitions.
npm install wkt-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use the `parse` function for WKT Point and Polygon strings, and how the parser handles unsupported WKT types with errors.
Avoid using `wkt-parser` for `GEOCCS` definitions. Consider pre-processing your WKT strings to exclude `GEOCCS` or use an alternative parser that supports them.
Ensure `COMPOUNDCS` strings are formatted according to WKT1 specifications when using this parser. For WKT2 `COMPOUNDCS`, you might need to adapt your input or use a different tool.
Always wrap parsing operations in a `try...catch` block. Implement client-side or server-side validation for WKT/PROJJSON strings before passing them to the parser to prevent unexpected application crashes.
Carefully review the WKT/PROJJSON string for typos, missing parentheses, incorrect delimiters, or unsupported elements. Ensure it adheres strictly to WKT1, WKT2, or PROJJSON specifications.
Ensure the parsing operation was successful by checking for errors (using `try...catch`). Verify the structure of the parsed output against the expected geometry type before accessing nested properties. The output structure can vary for different WKT types.
No dependency data recorded yet.