This repository provides tools for building JSON Schema docs for GeoJSON. A schema is generated for each of the GeoJSON object types, and each individual doc is complete (without $ref
s to other documents). So applications can consume just what they need and avoid extra fetching.
See JSON Schema docs for the GeoJSON types below:
FeatureCollection
Feature
Geometry
GeometryCollection
MultiPolygon
MultiLineString
MultiPoint
Polygon
LineString
Point
The overall GeoJSON schema can be found at
The schema files are also published to the geojson-schema
package on npm. You can add them as a dependency to your project with the following:
npm install geojson-schema
The schema can not be used to validate that linear rings are closed or that they follow the right-hand rule. These two elements of the GeoJSON specification cannot be represented in JSON Schema. To enforce these two elements of linear ring validation, parsers must implement their own logic on top of JSON Schema validation.
Install dependencies:
npm install
To build the schema docs:
make
The output will be in the build
directory.
A CI job builds commits pushed to main
. After a successful build, artifacts are pushed to the gh-pages
branch and will be accessible at geojson.org/schema/.json (e.g. https://geojson.org/schema/Point.json).
To publish the geojson-schema
package, run the following:
npm version minor # or major or patch
make build
git push --tags origin main
pushd build && npm publish && popd