Reputation: 1937
I would like to trigger NOTIFY
only on points that are in a certain PostGIS
region. I have a table called car
. I want to get a NOTIFY
cation every time a car updates it's coordinate or a new car is updated, but only in a certain region. Essentially I want to monitor for changes in rows that have a point that is located in the region of my interest.
I would be grateful for any hints in the right direction. Thank you in advance.
Upvotes: 1
Views: 80
Reputation: 115
if I understand correctly, you should follow a method like this,
1- fist of all you create a "view" which is return boolean value if your point of car and region interacts with each other. For this st_contains or st_intersects function be useful.
2- Create a trigger on the car table and the trigger should run every action of update or insert.
3- The trigger affects rows just be returned of the first view that you make
this might not be the best way but I think it can solve your situation.
Upvotes: 1