Open gmonk63 opened 6 years ago
After looking closer at the docs I see why its not working. I was assuming mutiple WHERE statements provided an OR like function but i was wrong. Is it possible to add a statement that provides this or do I need to use the WHEREIN and list 340,341,342,343,344,345...0,1,2,3,4,5,6,7...20 and does providing a large list like this take away from performance.
The WHEREIN with a list of options is one way, though I might be concerned with performance. Also try out the WHEREEVAL option. It utilizes the builtin Lua interpreter.
INTERSECTS FD WHEREEVAL "return FIELDS.Bearing >= 340 or FIELDS.Bearing <= 20" 0 ...
I recommend experimenting with both.
I have a hook set like this
{"ok":true,"hooks":[{"name":"geoId_0","key":"fleet","endpoints":["kafka://127.0.0.1:9092/geofishing","kafka://127.0.0.1:9093/geofishing","kafka://127.0.0.1:9094/geofishing","kafka://127.0.0.1:9095/geofishing","kafka://127.0.0.1:9096/geofishing","kafka://127.0.0.1:9097/geofishing","kafka://127.0.0.1:9098/geofishing"],"command":["INTERSECTS","fleet","FENCE","DETECT","enter","OBJECT","{\"type\":\"Feature\",\"properties\": {\"site\":\"Airport\",\"siteid\":\"10\", \"cid\": \"153\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[80.877656,26.761911],[80.877656,26.763941],[80.881754,26.763941],[80.881754,26.761911],[80.877656,26.761911]]]}}"]}],"elapsed":"0s"}
and when i do
set fleet 123123 POINT 80.881754 26.763941
No hooks getting fired
am i doing something wrong ?
The SET ... POINT command is in lat/lon order, not lon/lat
try
SET fleet 123123 POINT 26.763941 80.881754
Oh my bad... I will correct it...
if i have to detect "enter,exit" on object e.g below ``
r1.execute_command('SETHOOK', savetile, 'kafka://127.0.0.1:9092/geofishing,kafka://127.0.0.1:9093/geofishing,kafka://127.0.0.1:9094/geofishing,kafka://127.0.0.1:9095/geofishing,kafka://127.0.0.1:9096/geofishing,kafka://127.0.0.1:9097/geofishing,kafka://127.0.0.1:9098/geofishing', 'INTERSECTS','fleet','FENCE','DETECT','enter','exit','OBJECT',hookline)
its giving me error..
redis.exceptions.ResponseError: invalid argument 'exit'
''enter,exit',' this sovled it...
@abhit011 Good to hear. 👍
SETHOOK NB_6500 redis://localhost:6379/local INTERSECTS FD WHERE Bearing 340 +inf WHERE Bearing -inf 20 FENCE DETECT enter OBJECT { "type": "Feature", "properties": { "IntID": 6500, "Longitude": -111.840065942233, "Latitude": 33.400579713564497 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -111.840065942232997, 33.400579713564497 ], [ -111.83949460992865, 33.393726108276795 ], [ -111.840065942232997, 33.393709373780418 ], [ -111.840637274537343, 33.393726108276795 ], [ -111.840065942232997, 33.400579713564497 ] ] ] } }
Trying to create FENCE that will trigger webhook based on direction of travel using the bearing provided by GPS. All others work except Northbound. ex. Eastbound 70 +inf -inf 110 Westbound 250 +inf -inf 290 Southbound 160 +inf -inf 190 However it will work if i exclude WHERE Bearing -inf 20 but this will only cover someone traveling NNW to N where Im trying to cover NNW to NNE