# @placemarkio/check-geojson

> A spiritual successor to [geojsonhint](https://github.com/mapbox/geojsonhint), which is no longer maintained.

Latest version **0.1.14** (published 2025-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @placemarkio/check-geojson
pnpm add @placemarkio/check-geojson
yarn add @placemarkio/check-geojson
bun add @placemarkio/check-geojson
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.14 |
| Published | 2025-02-18 |
| First published | 2021-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 345.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 86 |
| Author | Tom MacWright |
| Maintainers | tmcw |

## Links

- npm: https://www.npmjs.com/package/@placemarkio/check-geojson
- Repository: https://github.com/placemark/check-geojson
- Homepage: https://github.com/placemark/check-geojson#readme
- Issues: https://github.com/placemark/check-geojson/issues
- npm.io page: https://npm.io/package/@placemarkio/check-geojson

## Recent versions

- 0.1.14 (latest) — 2025-02-18
- 0.1.7-2 (next) — 2021-07-21
- 0.1.13 — 2025-02-18
- 0.1.12 — 2022-05-23
- 0.1.11 — 2022-04-28
- 0.1.10 — 2022-04-13
- 0.1.9 — 2022-03-19
- 0.1.8 — 2022-02-19
- 0.1.7 — 2021-09-01
- 0.1.7-1 — 2021-07-19
- 0.1.7-0 — 2021-07-19
- 0.1.6 — 2021-07-02
- 0.1.5 — 2021-06-26
- 0.1.4 — 2021-06-26
- 0.1.3 — 2021-06-26
- … 2 more at https://npm.io/package/@placemarkio/check-geojson/versions

## README

# check-geojson

A spiritual successor to [geojsonhint](https://github.com/mapbox/geojsonhint), which is no longer maintained.

check-geojson is a parser and validator for GeoJSON strings. It is tailored to the use cases of validating user-generated GeoJSON content, or troubleshooting GeoJSON that you've received.

_Note: the API is not yet stable._

## [📕 API Documentation](http://check-geojson.docs.placemark.io/)

### Main differences from geojsonhint

- Actively maintained
- Written in TypeScript and includes types
- Uses [momoa](https://github.com/humanwhocodes/momoa) to parse JSON instead of a homemade
  parser. This is probably the biggest one. jsonlint-lines was a hack, which I created
  because I could not find a single parser that actually parsed JSON and gave line numbers
  for values. momoa is much better than that hack, and using it makes line-level errors
  much cleaner.

Unlike geojsonhint, this checker _only_ produces errors, not warnings. So things
that geojsonhint would warn about, like:

- excessive coordinate precision
- right-hand rule compliance

This does not check for. Additionally, the `crs` member is ignored by this tool: as of
the latest GeoJSON specification, this is [not used](https://datatracker.ietf.org/doc/html/rfc7946#appendix-B.1).

We're using the same test fixtures as geojsonhint as a starter.

### Install

```shell
pnpm add @placemarkio/check-geojson
yarn add @placemarkio/check-geojson
```

### Usage

```ts
import { check } from "@placemarkio/check-geojson"

let geojsonObject;
try {
  geojsonObject = check('… geojson string …')
} catch (e) {
  /// e.issues
}
```

If your GeoJSON is already an object, you will need to convert it to a string first. geojson-check will re-parse it. You should consider the performance penalty of this.

```ts
const issues = getIssues(JSON.stringify(geojsonObject));
if (issues.length > 0) {
  // ...
}
```

---

[![Maintainability](https://api.codeclimate.com/v1/badges/0a1d1c0755b9e67406f1/maintainability)](https://codeclimate.com/repos/60a64f6aa449b13bc40002bd/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/0a1d1c0755b9e67406f1/test_coverage)](https://codeclimate.com/repos/60a64f6aa449b13bc40002bd/test_coverage)

---
_Source: https://npm.io/package/@placemarkio/check-geojson · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
