node.js - PostGIS query with NodeJS, BookshelfJS and Knex -


i'm on project nodejs, bookshelfjs , expressjs. database postgres postgis installed. table 'organizations' has 'lat_lon' geometry column. query organization within fixed radius of specific lat/long point. tried this:

var organizations = await organization.query(function (qb) {  qb.where('st_dwithin(lat_lon, st_geomfromtext("point(45.43 10.99)", 4326), 1000 )')  }).fetchall() 

and more combinations doesn't work. returns me error

unhandledpromiserejectionwarning: unhandled promise rejection (rejection id: 1): typeerror: operator "undefined" not permitted

it seems expecting operator inside condition i'm working on 'lat_lon' column.

how can fix it? thanks

have tried using knex.raw()?

var organizations = await organization.query(function (qb) {  qb.where(knex.raw('st_dwithin(lat_lon, st_geomfromtext("point(45.43 10.99)", 4326), 1000 )')) }).fetchall() 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -