Add bulk geofences

Jeremy Dillon 5 years ago

I have about 1000 geofences I would like to add (they are customers and I want to track the time my drivers spend at each customer)
How can I add these in bulk?
Adding records to TC_GEOFENCES does not seem to work.
Any help would be appreciated.

Anton Tananaev 5 years ago

Use API:

https://www.traccar.org/traccar-api/

You can also do it directly through the database, but you have to link geofences to your user and also restart service.

Jeremy Dillon 5 years ago

Hi Anton,
Thanks for your help.
I added the geofences via sql in the console, linked to userid 1, restarted the service, and it worked!

For anyone who needs an example of the sql I ran in console, it looked like this for each new geofence ...

INSERT INTO 
TC_GEOFENCES(ID,NAME,DESCRIPTION,AREA,ATTRIBUTES) 
VALUES(7,'76820013 - SMASHCARE RINGWOOD','67280','CIRCLE (-37.8189814 145.2183688,85)','{}');

INSERT INTO
 TC_USER_GEOFENCE(USERID,GEOFENCEID) 
VALUES(1,7);