a Geojson utility for validating data using Clojure(script)'s spec (RFC 7946)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources
src/hiposfer/geojson
test/hiposfer/geojson
.gitignore
.travis.yml
LICENSE
README.md
project.clj

README.md

geojson.specs Build Status Clojars Project

a Geojson utility for validating data using Clojure(script)'s spec following RFC 7946.

(ns example
  (:require [hiposfer.geojson.specs :as geojson]))
            [clojure.spec.alpha :as s] 

(s/valid? ::geojson/point {:type "Point" :coordinates [1 2 3]})

(s/valid? ::geojson/linestring {:type "LineString" :coordinates [[1 2 3]
                                                                 [4 5 6]]})

The hiposfer.geojson.specs namespace also contains some utility functions for working with geojson. Currently those are:

  • limited-feature: creates a spec that only allows geojson features of the specified type. For example: (geojson/limited-feature ::geojson/point). help wanted. See issue
  • bbox: get or compute (if not available) the bounding box of a geojson object. Throws on "Point" without bbox
  • uri: takes a point (or feature-point) and returns a lon,lat,height string.
  • geo-uri takes a point (or feature-point) and returns a geo:lon,lat,height string

Distributed under LGPL v3