bookshelf-geojson
This Bookshelf.js plugin automatically parses and formats PostGIS geometry columns as GeoJSON in your models.
Developed at the Media Engineering Institute (HEIG-VD).
Usage
const bookshelf = ;const bookshelfGeojson = ;const knex = ; const db = ; const Bookshelf = ;Bookshelf; const Address = BookshelfModel; const geojson = type: 'Point' coordinates: 24 42 ; // The GeoJSON is automatically serialized for PostGIS.const address = ;address;address; // The GeoJSON is automatically parsed with PostGIS's ST_AsGeoJSON function.const anotherAddress = id: 1 ;console;// { id: 1, location: { type: 'Point', coordinates: [ 33, 66 ] } }