Geojson-Schema v0.1.1 Release

I'm excited to announce the release of the first version of Geojson-Schema under the Apache 2.0 License. This project came from some of the work I did building geospatial tools in Clojure for The Climate Corporation.

Built as a set of schema defintions on top of Prismatic's wonderful Schema librrary, you can now validate the type of GeoJSON in clojure and get an expressive explanation of why a particular data structure complies with the spec or not.

(require '[com.climate.geojson-schema.core :refer [MultiPolygon GeoJSON]]); nil
(require '[schema.core :as s]); nil
(def multipolygon-example
  {:type "MultiPolygon", 
   :coordinates [[[[102.0 2.0] [103.0 2.0] [103.0 3.0] [102.0 2.0]]] 
                 [[[100.0 0.0] [101.0 0.0] [101.0 1.0] [100.0 0.0]] 
                  [[100.2 0.2] [100.8 0.2] [100.8 0.8] [100.2 0.2]]]]})
;; => user/multipolygon-example

(s/validate MultiPolygon multipolygon-example)
;; => {:coordinates [[[[102.0 2.0] [103.0 2.0] [103.0 3.0] [102.0 2.0]]] 
;;                   [[[100.0 0.0] [101.0 0.0] [101.0 1.0] [100.0 0.0]] 
;;                    [[100.2 0.2] [100.8 0.2] [100.8 0.8] [100.2 0.2]]]], 
;;     :type "MultiPolygon"}

(def not-really-a-multipolygon
 {:type "Point"
  :coordinates [100.0 0.0]})

(s/validate MultiPolygon not-really-a-multipolygon)
; => ExceptionInfo Value does not match schema: {:type (not (= "MultiPolygon" "Point"))...

;;But it's still valid Geojson
(s/validate GeoJSON not-really-a-multipolygon)
; => {:coordinates [100.0 0.0], :type "Point"}

I hope to add cljx support so that this library can be used from within clojurescript applications shortly.

Update: These examples are displaying oddly on small screens. Please see the readme on github for more prettily formatted examples.