I am building a simple API that also deal with geometries (store into postGIS). I am using knex-postgis to access the ST_ spatial functions in postGIS with knex.I have used this example to insert a point and it works. But my lack of experience is leave me hanging, how can I make the query dynamic? I want to create a form with input for x and y value and send it to the ST_geomFromText function to save it to the geom type in the db. Is this when you would use parameters? Could someone point me in the right direction?// 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')
Submitted December 03, 2017 at 11:25AM by geoholic
No comments:
Post a Comment