Options
All
  • Public
  • Public/Protected
  • All
Menu

@placemarkio/check-geojson

check-geojson

check-geojson development is supported by 🌎 placemark.io

geojsonhint for 2021.

I started working on geojsonhint in 2014. It's a pretty useful project. But it has been stagnant for a long time now, and has some annoying long-term issues.

check-geojson is intended to be a full successor for geojsonhint. Like geojsonhint, it is tailored to a particular usecase: writing GeoJSON by hand, or quickly sussing out issues in GeoJSON that you've received.

📕 API Documentation

Main differences from geojsonhint

  • Actively maintained
  • Written in TypeScript and includes types
  • Uses 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.

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

Usage

Not finalized yet

import { check } from "check-geojson"

try {
const parseValue = check('… geojson string …')
} catch (e) {
/// e.issues
}

Maintainability Test Coverage

Generated using TypeDoc