Skip to content

a checker for the geojson format. goes beyond a schema, checking semantics and producing character-level warnings.

License

Notifications You must be signed in to change notification settings

placemark/check-geojson

Repository files navigation

check-geojson

check-geojson development is supported by 🌎 placemark.io

geojsonhint for 2023.

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.

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.

Install

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

Usage

Not finalized yet

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

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

Maintainability Test Coverage

About

a checker for the geojson format. goes beyond a schema, checking semantics and producing character-level warnings.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •