[GIS] find lat,long inside polygon with regular interval of time using thesql

geofencingMySQL

I have table latest location there i have lat and long with device id.
one more table with fencing name,there i have polygon points.
so now how i can check point lies inside polygon.
i need this with regular interval of time and storing that to new table.
so how to find this with MySQL function,event or with procedure?

Best Answer

Create a trigger for your location table: http://dev.mysql.com/doc/refman/5.6/en/trigger-syntax.html and inside the trigger function use st_within