Grist is a set of tools for managing spatial data non-relationally. A Grist database is a collection of features of the form:
{
"geom": 'POINT (0.0 0.0)',
"attr": {
},
"_rev": "1-4c1cee11d99c19cbc6d762b11f1b5b21"
}
...where "geom" is the Well-Known Text geometry, "attr" is the attribute data (or document), and "_rev" is the revision (modeled after the CouchDB style of ordinal+md5hash and used for conflict resolution, etc.).
The gristmgr program requires libgeos, libtokyocabinet, and libmozjs185.
The gristmgr tool provides management facilities for grist databases. Usage is as follows:
gristmgr v0.01
usage: gristmgr cmd [options...] path [params...]
init path
stat path
list [-pv] path
put path [key] wkt-geom json-object
get path [-wb|-js|-gj|-wt] key
del path key
eval path key script
map path script
mkview path view [-lu|-js] script
rmview path view
vget path view key
version
help
>gristmgr init mydatabase.grist
>gristmgr stat mydatabase.grist
>gristmgr list mydatabase.grist
>gristmgr put mydatabase.grist myfeature 'POINT (-71.0617 42.3578)' '{"name": "Boston", "nicknames": ["Beantown","St. Botolph\'s Town"]}'
>gristmgr get mydatabase.grist myfeature
>gristmgr del mydatabase.grist myfeature
>gristmgr eval mydatabase.grist myfeature myjavascript.js
>gristmgr map mydatabase.grist myjavascript.js
Grist files consist of features and metadata. A feature is a geometry (libgeos) and a "document" (json-serialized object). Database files are Tokyo Cabinet key-value stores. Javascript functions may be evaluated against individual keys or against all features in the database:
>gristmgr eval mygristdb.grist mykey mymapfunction.js
>gristmgr map mygristdb mymapfunction.js
- View generation
- Multiple output formats for map and eval functions(including geojson)
- RESTful server (gristd)