Clojure utilities for using GeoJSON.
Add the following dependency to your project.clj
:
[com.farmlogs/geojson "1.1.0"]
- Install: https://pre-commit.com/
- running locally: This will also happen automatically before committing to a branch, but you can also run the tasks with
pre-commit run --all-files
This library's utilities act on clojure maps structured as GeoJSON.
The validation namespace verifies that a given GeoJSON is valid, following the details of the geojson spec.
(require '[geojson.validate :as gv])
(gv/valid? {:type "Point" :coordinates [0 0]})
(gv/valid? {:type "Feature"
:properties {:name "Null Island"}
:geometry {:type "Point" :coordinates [0 0]}})
(gv/valid? {:type "GeometryCollection"
:geometries [{:type "Point" :coordinates [0 0]}
{:type "Polygon" :coordinates [[[0 0] [0 1] [1 1] [1 0] [0 0]]]}
{:type "LineString" :coordinates [[0 0] [1 1] [1 2]]}]})