I have a query that searches through a list of polygons and checks to see if any of a list of points is included. My problem is I need to some how insert a indicator of which polygon the point was found in.
Here is my query:
function fieldGeoFilteringFn(){
r.connect(config.rethinkdb, function(err, conn){
if(err) {
console.log('conn err', err)
}
r.db('queue').table('activeJobs').forEach(function(id) {
return r.db('queue').table('fieldTrucks').insert( r.db('queue').table('tracksInit').getIntersecting(
r.db('queue').table('activeJobs').get(id('id'))('shape')('location') , {index: 'geometry'}).pluck(
['Heading', 'MobileName', 'geometry', 'id', 'Speed', 'HardwareId'])) }).run(conn, function(err,result){
if(err) {
console.log("Insert Field Trucks err", err)
} else {
console.log("Field truck insert")
}
})
})
}
The id from each of the activeJobs is what I would like to insert along with the other fields am "plucking".
If more information is needed just let me know.
Thanks!