Demo entry 6760842

find nearest point


Submitted by anonymous on Sep 18, 2018 at 21:21
Language: JavaScript. Code size: 429 Bytes.'/findpoint', (req,res) => {
    pool.query (`SELECT id, long, lat FROM coord Order by st_distance(ST_SetSrid(ST_MakePoint(long, lat),4326), ST_SetSrid(ST_MakePoint(${req.body.x}, ${req.body.y}),4326)) ASC LIMIT 1;`, 
    (err, dbResponse) => {
        if (err) console.log(err);
        res.setHeader('Access-Control-Allow-Origin', '*');

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).