Traccar + Overpass API SpeedLimit Error

RB_NZ2 years ago

I have been trialing Traccar as a tracking solution for vehicles. Its working really well. I can see the devices communicating successfully and populating into the SQL database I have setup.
I decided it would be nice to have real speed limit data, so I have setup an Overpass API server that i can query. I have added the config values to the traccar.xml file.

    <entry key='speedLimit.enable'>True</entry>
    <entry key='speedLimit.type'>overpass</entry>
    <entry key='speedLimit.url'>http://overpass.local/api/interpreter</entry>

When I restart the service to apply this config, I get a flood of errors in the traccar log;

2023-01-20 16:27:18  WARN: Speed limit provider failed - Not found - SpeedLimitException (OverpassSpeedLimitProvider:65 < *:52 < ...)
2023-01-20 16:27:18  WARN: Speed limit provider failed - Not found - SpeedLimitException (OverpassSpeedLimitProvider:65 < *:52 < ...)
2023-01-20 16:27:18  WARN: Speed limit provider failed - Not found - SpeedLimitException (OverpassSpeedLimitProvider:65 < *:52 < ...)
2023-01-20 16:27:18  WARN: Speed limit provider failed - Not found - SpeedLimitException (OverpassSpeedLimitProvider:65 < *:52 < ...)
2023-01-20 16:27:18  WARN: Speed limit provider failed - Not found - SpeedLimitException (OverpassSpeedLimitProvider:65 < *:52 < ...)
2023-01-20 16:27:18  WARN: Speed limit provider failed - Not found - SpeedLimitException (OverpassSpeedLimitProvider:65 < *:52 < ...)

and no data is recorded into the database.

At first I thought it was maybe an issue with the Overpass instance I had built, but have thoroughly tested it and seems to work correctly. I can see in the Apache log the requests from the Traccar VM;

[20/Jan/2023:15:53:39 +1300] "GET /api/interpreter?data=[out:json];way[maxspeed](around:100.0,-39.060233,174.066500);out%20tags; HTTP/1.1" 200 1049 "-" "Jersey/2.37 (HttpUrlConnection 17.0.4)"
[20/Jan/2023:15:53:39 +1300] "GET /api/interpreter?data=[out:json];way[maxspeed](around:100.0,-41.109338,175.253113);out%20tags; HTTP/1.1" 200 1203 "-" "Jersey/2.37 (HttpUrlConnection 17.0.4)"
[20/Jan/2023:15:53:39 +1300] "GET /api/interpreter?data=[out:json];way[maxspeed](around:100.0,-36.922832,174.659063);out%20tags; HTTP/1.1" 200 828 "-" "Jersey/2.37 (HttpUrlConnection 17.0.4)"
[20/Jan/2023:15:53:39 +1300] "GET /api/interpreter?data=[out:json];way[maxspeed](around:100.0,-37.777450,175.274582);out%20tags; HTTP/1.1" 200 2160 "-" "Jersey/2.37 (HttpUrlConnection 17.0.4)"
[20/Jan/2023:15:53:39 +1300] "GET /api/interpreter?data=[out:json];way[maxspeed](around:100.0,-37.791175,175.320363);out%20tags; HTTP/1.1" 200 1468 "-" "Jersey/2.37 (HttpUrlConnection 17.0.4)"
[20/Jan/2023:15:53:39 +1300] "GET /api/interpreter?data=[out:json];way[maxspeed](around:100.0,-37.038058,174.920770);out%20tags; HTTP/1.1" 200 819 "-" "Jersey/2.37 (HttpUrlConnection 17.0.4)"

Also tried to put one of the public Overpass instances into my config https://maps.mail.ru/osm/tools/overpass/api/interpreter and got the same problem.

So then I set the 'speedLimit.enable' to false and restart the service, then all the next device comms starts to appear in the database again.

Can anyone assist with this WARN: Speed limit provider failed - Not found - SpeedLimitException (OverpassSpeedLimitProvider:65 < *:52 < ...) error, and even if this error occurs with speed lookup there should be error handling in the system so the data still appears in the database.

Anton Tananaev2 years ago

What does the response look like?

RB_NZ2 years ago

Hi Anton,
If you are meaning the reply from Overpass, here is an example;
This API call; http://overpass.local/api/interpreter?data=[out:json];way[maxspeed](around:100.0,-37.038058,174.920770);out%20tags;
returns this;

{
  "version": 0.6,
  "generator": "Overpass API 0.7.59.1 2a9d9642",
  "osm3s": {
    "timestamp_osm_base": "2023-01-21T21:21:39Z",
    "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
  },
  "elements": [

{
  "type": "way",
  "id": 450033545,
  "tags": {
    "highway": "secondary",
    "lanes": "2",
    "lanes:backward": "1",
    "lanes:forward": "1",
    "maxspeed": "50",
    "name": "Manuroa Road",
    "source:maxspeed": "https://data-atgis.opendata.arcgis.com/datasets/d43c489e7027489b88bcdedffc3be6c6_0",
    "surface": "paved"
  }
}

  ]
}
Anton Tananaev2 years ago

Well, the "Not found" error means that the "elements" array is empty, so clearly that's not the actual response.

RB_NZ2 years ago

On my Traccar Ubuntu vm I have used curl, and got the response below. Is there some other test or log you suggest?
This is an exact copy/paste from the ubuntu console;
curl http://overpass.local/api/interpreter?data=%5Bout%3Ajson%5D%3Bway%5Bmaxspeed%5D%28around%3A100.0%2C-37.038058%2C174.920770%29%3Bout%20tags%3B

{
  "version": 0.6,
  "generator": "Overpass API 0.7.59.1 2a9d9642",
  "osm3s": {
    "timestamp_osm_base": "2023-01-21T21:21:39Z",
    "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
  },
  "elements": [

{
  "type": "way",
  "id": 450033545,
  "tags": {
    "highway": "secondary",
    "lanes": "2",
    "lanes:backward": "1",
    "lanes:forward": "1",
    "maxspeed": "50",
    "name": "Manuroa Road",
    "source:maxspeed": "https://data-atgis.opendata.arcgis.com/datasets/d43c489e7027489b88bcdedffc3be6c6_0",
    "surface": "paved"
  }
}

  ]
}
Anton Tananaev2 years ago

You can either debug Traccar and check the actual response. Alternatively you can capture it using something like Wireshark.

RB_NZ2 years ago

I set the Traccar logging level to all and could not see the calls.
Installed tshark onto the Ubuntu Overpass machine to the the HTTP calls and reponse and it appears to be as expected when Traccar trys to lookup a speedlimit

Frame 3811: 71 bytes on wire (568 bits), 71 bytes captured (568 bits) on interface ens160, id 0
Ethernet II, Src: VMware_b2:d3:c2 (00:50:56:b2:d3:c2), Dst: VMware_b2:14:c0 (00:50:56:b2:14:c0)
Internet Protocol Version 4, Src: 10.201.0.124, Dst: 10.201.0.123
Transmission Control Protocol, Src Port: 80, Dst Port: 34010, Seq: 1415, Ack: 539, Len: 5
[2 Reassembled TCP Segments (718 bytes): #3809(713), #3811(5)]
Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
        [Expert Info (Chat/Sequence): HTTP/1.1 200 OK\r\n]
            [HTTP/1.1 200 OK\r\n]
            [Severity level: Chat]
            [Group: Sequence]
        Response Version: HTTP/1.1
        Status Code: 200
        [Status Code Description: OK]
        Response Phrase: OK
    Date: Mon, 23 Jan 2023 02:42:14 GMT\r\n
    Server: Apache/2.4.52 (Ubuntu)\r\n
    Content-Type: application/json\r\n
    Keep-Alive: timeout=5, max=99\r\n
    Connection: Keep-Alive\r\n
    Transfer-Encoding: chunked\r\n
    \r\n
    [HTTP response 2/2]
    [Time since request: 0.093329347 seconds]
    [Prev request in frame: 3590]
    [Prev response in frame: 3639]
    [Request in frame: 3777]
    [Request URI: http://10.201.0.124/api/interpreter?data=[out:json];way[maxspeed](around:100.0,-38.370115,175.803163);out%20tags;]
    HTTP chunked response
        Data chunk (503 octets)
            Chunk size: 503 octets
            Data (503 bytes)

0000  7b 0a 20 20 22 76 65 72 73 69 6f 6e 22 3a 20 30   {.  "version": 0
0010  2e 36 2c 0a 20 20 22 67 65 6e 65 72 61 74 6f 72   .6,.  "generator
0020  22 3a 20 22 4f 76 65 72 70 61 73 73 20 41 50 49   ": "Overpass API
0030  20 30 2e 37 2e 35 39 2e 31 20 32 61 39 64 39 36    0.7.59.1 2a9d96
0040  34 32 22 2c 0a 20 20 22 6f 73 6d 33 73 22 3a 20   42",.  "osm3s":
0050  7b 0a 20 20 20 20 22 74 69 6d 65 73 74 61 6d 70   {.    "timestamp
0060  5f 6f 73 6d 5f 62 61 73 65 22 3a 20 22 32 30 32   _osm_base": "202
0070  33 2d 30 31 2d 32 32 54 32 31 3a 32 31 3a 31 30   3-01-22T21:21:10
0080  5a 22 2c 0a 20 20 20 20 22 63 6f 70 79 72 69 67   Z",.    "copyrig
0090  68 74 22 3a 20 22 54 68 65 20 64 61 74 61 20 69   ht": "The data i
00a0  6e 63 6c 75 64 65 64 20 69 6e 20 74 68 69 73 20   ncluded in this
00b0  64 6f 63 75 6d 65 6e 74 20 69 73 20 66 72 6f 6d   document is from
00c0  20 77 77 77 2e 6f 70 65 6e 73 74 72 65 65 74 6d    www.openstreetm
00d0  61 70 2e 6f 72 67 2e 20 54 68 65 20 64 61 74 61   ap.org. The data
00e0  20 69 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62    is made availab
00f0  6c 65 20 75 6e 64 65 72 20 4f 44 62 4c 2e 22 0a   le under ODbL.".
0100  20 20 7d 2c 0a 20 20 22 65 6c 65 6d 65 6e 74 73     },.  "elements
0110  22 3a 20 5b 0a 0a 7b 0a 20 20 22 74 79 70 65 22   ": [..{.  "type"
0120  3a 20 22 77 61 79 22 2c 0a 20 20 22 69 64 22 3a   : "way",.  "id":
0130  20 38 31 33 37 39 39 35 35 37 2c 0a 20 20 22 74    813799557,.  "t
0140  61 67 73 22 3a 20 7b 0a 20 20 20 20 22 68 69 67   ags": {.    "hig
0150  68 77 61 79 22 3a 20 22 70 72 69 6d 61 72 79 22   hway": "primary"
0160  2c 0a 20 20 20 20 22 6c 61 6e 65 73 22 3a 20 22   ,.    "lanes": "
0170  32 22 2c 0a 20 20 20 20 22 6d 61 78 73 70 65 65   2",.    "maxspee
0180  64 22 3a 20 22 31 30 30 22 2c 0a 20 20 20 20 22   d": "100",.    "
0190  6e 61 6d 65 22 3a 20 22 57 68 61 6b 61 6d 61 72   name": "Whakamar
01a0  75 20 52 6f 61 64 22 2c 0a 20 20 20 20 22 6f 6e   u Road",.    "on
01b0  65 77 61 79 22 3a 20 22 6e 6f 22 2c 0a 20 20 20   eway": "no",.
01c0  20 22 72 65 66 22 3a 20 22 53 48 20 33 32 22 2c    "ref": "SH 32",
01d0  0a 20 20 20 20 22 73 75 72 66 61 63 65 22 3a 20   .    "surface":
01e0  22 61 73 70 68 61 6c 74 22 0a 20 20 7d 0a 7d 0a   "asphalt".  }.}.
01f0  0a 20 20 5d 0a 7d 0a                              .  ].}.
                Data: 7b0a20202276657273696f6e223a20302e362c0a20202267656e657261746f72223a2022…
                [Length: 503]
            Chunk boundary: 0d0a
        End of chunked encoding
            Chunk size: 0 octets
        \r\n
    File Data: 503 bytes
JavaScript Object Notation: application/json
Anton Tananaev2 years ago

Don't really have any other ideas.

jata9 months ago

I know this is an old thread but I thought I would contribute as I might have a solution. I have speedlimit tracking setup in the same way and intermittently had the same issue with the same error code.

I tracked this down to certain GPS devices when GPS accuracy was comparably low (e.g. 35m = low accuracy for me).

I checked settings in traccar.xml for speedlimit and I had 'speedLimit.accuracy' set at 40m (I think default is 50).

Anyway, I increased 'speedLimit.accuracy' setting (to 50) and this solved the problem.

So I think what is happening is that the api to/from overpass takes GPS accuracy into consideration and will return an empty dataset for speedlimit that generates the error.

Hope this helps other folks here

Anton Tananaev9 months ago

The default value is 100m.

jata9 months ago

OK thanks. Apologies for incorrect info. In any case by increasing the speedlimit accuracy has helped me understand and solve this issue.

Thanks for such a great opensource platform by the way. I have this integrated it with my Home Assistant setup and have made quite good progress pushing gps data into traccar from HA and getting back speedlimit data to link up the data

Mambus19 days ago

I know is a old thread but my test showed the problem occurs when the overpass server returns maxspeed value not as a integer, like below:

{
  "version": 0.6,
  "generator": "Overpass API 0.7.62 7c32a7d5",
  "osm3s": {
    "timestamp_osm_base": "2024-12-02T21:13:52Z",
    "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
  },
  "elements": [

{
  "type": "way",
  "id": 23600199,
  "tags": {
    "highway": "residential",
    "lanes": "2",
    "maxspeed": "RO:urban",
    "name": "Strada Sabarului",
    "oneway": "no",
    "surface": "asphalt"
  }
}
  ]
}

does anybody has some tips for a quick fix? maybe it should have a "map" with the default speeds for each country ( urban and rural etc ).

Anton Tananaev19 days ago

Yeah, it would require some database with speed limits per country.