All Projects → jfgodoy → Knex Postgis

jfgodoy / Knex Postgis

Licence: mit
postgis extension for knex

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Knex Postgis

Martin
Blazing fast and lightweight PostGIS vector tiles server
Stars: ✭ 540 (+280.28%)
Mutual labels:  postgis
Postgis
PostGIS spatial database extension to PostgreSQL [mirror]
Stars: ✭ 925 (+551.41%)
Mutual labels:  postgis
Xyz
An open source javascript framework for spatial data and application interfaces.
Stars: ✭ 54 (-61.97%)
Mutual labels:  postgis
Spatial
Neo4j Spatial is a library of utilities for Neo4j that faciliates the enabling of spatial operations on data. In particular you can add spatial indexes to already located data, and perform spatial operations on the data like searching for data within specified regions or within a specified distance of a point of interest. In addition classes are provided to expose the data to geotools and thereby to geotools enabled applications like geoserver and uDig.
Stars: ✭ 695 (+389.44%)
Mutual labels:  postgis
Docker Postgis
Docker image for PostGIS
Stars: ✭ 821 (+478.17%)
Mutual labels:  postgis
Building Server
A server to stream PostGIS 3D objects to the web
Stars: ✭ 11 (-92.25%)
Mutual labels:  postgis
docker-django
Base Docker image for Django and Gunicorn.
Stars: ✭ 29 (-79.58%)
Mutual labels:  postgis
Baremaps
Custom vector tiles from OpenStreetMap and other data sources.
Stars: ✭ 100 (-29.58%)
Mutual labels:  postgis
Docker Postgres
A docker container running PostgreSQL
Stars: ✭ 22 (-84.51%)
Mutual labels:  postgis
Osm2pgsql
OpenStreetMap data to PostgreSQL converter
Stars: ✭ 1,042 (+633.8%)
Mutual labels:  postgis
Activerecord Postgis Adapter
ActiveRecord connection adapter for PostGIS, based on postgresql and rgeo
Stars: ✭ 746 (+425.35%)
Mutual labels:  postgis
Pgrouting
Repository contains pgRouting library. Development branch is "develop", stable branch is "master"
Stars: ✭ 804 (+466.2%)
Mutual labels:  postgis
Postgresql Postgis Timescaledb
PostgreSQL + PostGIS + TimescaleDB docker image 🐘🌎📈
Stars: ✭ 19 (-86.62%)
Mutual labels:  postgis
Postgresapp
The easiest way to get started with PostgreSQL on the Mac
Stars: ✭ 6,118 (+4208.45%)
Mutual labels:  postgis
Python Postgis
PostGIS helpers for psycopg2 and asyncpg
Stars: ✭ 59 (-58.45%)
Mutual labels:  postgis
Tasking Manager
Tasking Manager - The tool to team up for mapping in OpenStreetMap
Stars: ✭ 328 (+130.99%)
Mutual labels:  postgis
Geography for hackers
Geography for Hackers - Teaching all how to hack geography, use GIS, and think spatially
Stars: ✭ 25 (-82.39%)
Mutual labels:  postgis
Terrain Classic
World-wide CartoCSS port of Stamen's classic terrain style
Stars: ✭ 110 (-22.54%)
Mutual labels:  postgis
Geotools
Official GeoTools repository
Stars: ✭ 1,109 (+680.99%)
Mutual labels:  postgis
Djangorestframework Mvt
Serve Mapbox Vector Tiles with Django and Postgres
Stars: ✭ 33 (-76.76%)
Mutual labels:  postgis

knex-postgis

npm version npm downloads Build Status Dependencies Status License

Extension for use postgis functions in knex SQL query builder.

Example

This example show the sql generated by the extension.

const knex = require('knex');
const knexPostgis = require('knex-postgis');

const db = knex({
  client: 'postgres'
});

// install postgis functions in knex.postgis;
const st = knexPostgis(db);
/* or:
 * knexPostgis(db);
 * const st = db.postgis;
 */

// insert a point
const sql1 = db.insert({
  id: 1,
  geom: st.geomFromText('Point(0 0)', 4326)
}).into('points').toString();
console.log(sql1);
// insert into "points" ("geom", "id") values (ST_geomFromText('Point(0 0)'), '1')

// find all points return point in wkt format
const sql2 = db.select('id', st.asText('geom')).from('points').toString();
console.log(sql2);
// select "id", ST_asText("geom") as "geom" from "points"

// all methods support alias
const sql3 = db.select('id', st.asText(st.centroid('geom')).as('centroid')).from('geometries').toString();
console.log(sql3);
// select "id", ST_asText(ST_centroid("geom")) as "centroid" from "geometries"

Currently supported functions

Define extra functions

const knex = require('knex');
const knexPostgis = require('knex-postgis');

const db = knex({
  client: 'postgres'
});

knexPostgis(db);

db.postgisDefineExtras((knex, formatter) => ({
  utmzone(geom) {
    return knex.raw('utmzone(?)', [formatter.wrapWKT(geom)]);
  }
}));
//now you can use st.utmzone function in the same way as predefined functions
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].