Data on speeding events

Javier Marcosa year ago

I am forwarding events, this works correctly.I save all the events I receive with their complete information.
I'm checking the speeding events and see something strange. Below I explain what I found.

  • I have a device set with a speed limit of 30 km/h.
  • I have a geofence set with a speed limit of 20 km/h.

The speed event is occurring on the geofence. I know this because I have the following information:

"event": {
    "id": 2616337,
    "attributes": {
      "speed": 17.29,
      "speedLimit": 10.79913606911447
    },
    "deviceId": 183,
    "type": "deviceOverspeed",
    "eventTime": "2023-09-13T17:24:37.000+00:00",
    "positionId": 14012169,
    "geofenceId": 0,
    "maintenanceId": 0
  },

The speedLimit indicates 10.79913606911447 -> Geofence (20 km/h.)

Since using Traccar I know that when an event occurs on a geofence I also receive information about said geofence. In this case I do not receive the geofence information and that is what is strange.

For other speeding events, I receive such information. For example:

"geofence": {
    "id": 92,
    "attributes": {
      "speedLimit": 10.79913606911447
    },
    "calendarId": 0,
    "name": "ANY NAME",
    "description": "",
    "area": "LINESTRING (......)"
  }

I have also noticed that in the data of the device that sends me the event I have the following information:

"geofenceIds": [
      109
  ],

I know geofenceIds indicates the geofences the device is in at the time of the event.

In cases where I don't receive the geofence data, I see the geofence appear in geofenceIds.
Why am I not receiving geofence information? Why could this be happening?

Anton Tananaeva year ago

For other speeding events, I receive such information.

Please provide full example.

Javier Marcosa year ago

I send a complete example where I do receive geofence information.

{
  "event": {
    "id": 2669074,
    "attributes": {
      "speed": 15.15,
      "speedLimit": 10.79913606911447
    },
    "deviceId": 183,
    "type": "deviceOverspeed",
    "eventTime": "2023-09-14T12:57:16.000+00:00",
    "positionId": 14243645,
    "geofenceId": 92,
    "maintenanceId": 0
  },
  "position": {
    "id": 14243645,
    "attributes": {
      "distance": 240.87,
      "totalDistance": 836229.66,
      "motion": true,
      "hours": 9000
    },
    "deviceId": 183,
    "protocol": "gps103",
    "serverTime": "2023-09-14T12:57:18.216+00:00",
    "deviceTime": "2023-09-14T12:57:16.000+00:00",
    "fixTime": "2023-09-14T12:57:16.000+00:00",
    "outdated": false,
    "valid": true,
    "latitude": -6.175152,
    "longitude": -79.99197516666666,
    "altitude": 0,
    "speed": 15.15,
    "course": 87.57,
    "address": null,
    "accuracy": 0,
    "network": null
  },
  "device": {
    "id": 183,
    "attributes": {
      "speedLimit": 16.198704103671705
    },
    "groupId": 1,
    "name": "ANY NAME DEVICE",
    "uniqueId": "868166055754321",
    "status": "online",
    "lastUpdate": "2023-09-14T12:57:18.216+00:00",
    "positionId": 14238467,
    "geofenceIds": [
      92
    ],
    "phone": null,
    "model": "",
    "contact": "",
    "category": "scooter",
    "disabled": false,
    "expirationTime": null
  },
  "geofence": {
    "id": 92,
    "attributes": {
      "speedLimit": 10.79913606911447
    },
    "calendarId": 0,
    "name": "ANY NAME GEOFENCE",
    "description": "",
    "area": "LINESTRING (-6.175192358035034 -79.99833508659192, -6.175171024867808 -79.9950145118315, -6.175165691575884 -79.99172612357928)"
  }
}
Anton Tananaeva year ago

I checked the code. The geofence should be included if it was a geofence limit.

Javier Marcosa year ago

But the speed limit I get refers to the geofence, not the device.
I send a complete example where I receive no geofence information.

{
  "event": {
    "id": 2616337,
    "attributes": {
      "speed": 17.29,
      "speedLimit": 10.79913606911447
    },
    "deviceId": 183,
    "type": "deviceOverspeed",
    "eventTime": "2023-09-13T17:24:37.000+00:00",
    "positionId": 14012169,
    "geofenceId": 0,
    "maintenanceId": 0
  },
  "position": {
    "id": 14012169,
    "attributes": {
      "distance": 274.26,
      "totalDistance": 806288.68,
      "motion": true,
      "hours": 9000
    },
    "deviceId": 183,
    "protocol": "gps103",
    "serverTime": "2023-09-13T17:24:40.324+00:00",
    "deviceTime": "2023-09-13T17:24:37.000+00:00",
    "fixTime": "2023-09-13T17:24:37.000+00:00",
    "outdated": false,
    "valid": true,
    "latitude": -6.1949705,
    "longitude": -79.98779066666667,
    "altitude": 0,
    "speed": 17.29,
    "course": 87.58,
    "address": null,
    "accuracy": 0,
    "network": null
  },
  "device": {
    "id": 183,
    "attributes": {
      "speedLimit": 16.198704103671705
    },
    "groupId": 1,
    "name": "ANY NAME DEVICE",
    "uniqueId": "868166055754321",
    "status": "online",
    "lastUpdate": "2023-09-13T17:24:40.324+00:00",
    "positionId": 0,
    "geofenceIds": [
      109
    ],
    "phone": null,
    "model": "",
    "contact": "",
    "category": "scooter",
    "disabled": false,
    "expirationTime": null
  }
}

I mention that I have not modified anything relevant.

I have just observed that in the latter: device->positionId = 0
In the previous one (where the geofence is sent): device->positionId = 14238467 (there is a value)
Could it be the cause?

Anyway, thanks for taking the time, Anton.

Anton Tananaeva year ago

You shouldn't look at the geofenceIds field. That's just the current geofence, but it doesn't mean that we use the limit from that geofence. The fact that you don't have the geofence tells me that the limit is not coming from any geofence.

Javier Marcosa year ago

If the boundary is not from the geofence and is not the boundary configured for the device. Where could that limit that shows me in the event information come from?

Anton Tananaeva year ago

Speed limit can also be coming from the config, device, groups and external provider.