diff options
author | Anton Tananaev <anton@traccar.org> | 2023-09-11 21:52:13 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-09-11 21:52:13 -0700 |
commit | e000421d9e67960d28666471bf8ea8c7b629dd9d (patch) | |
tree | c427c23f26431cee0027818db14daefb28801856 /src/main/java/org/traccar/speedlimit | |
parent | 023ab3249c1cbeb89e44af0d9f6c98130519a67d (diff) | |
download | trackermap-server-e000421d9e67960d28666471bf8ea8c7b629dd9d.tar.gz trackermap-server-e000421d9e67960d28666471bf8ea8c7b629dd9d.tar.bz2 trackermap-server-e000421d9e67960d28666471bf8ea8c7b629dd9d.zip |
Add speed limit accuracy (fix #5175)
Diffstat (limited to 'src/main/java/org/traccar/speedlimit')
-rw-r--r-- | src/main/java/org/traccar/speedlimit/OverpassSpeedLimitProvider.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/speedlimit/OverpassSpeedLimitProvider.java b/src/main/java/org/traccar/speedlimit/OverpassSpeedLimitProvider.java index 60ad65f9e..a25eedb2c 100644 --- a/src/main/java/org/traccar/speedlimit/OverpassSpeedLimitProvider.java +++ b/src/main/java/org/traccar/speedlimit/OverpassSpeedLimitProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 - 2022 Anton Tananaev (anton@traccar.org) + * Copyright 2020 - 2023 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ */ package org.traccar.speedlimit; +import org.traccar.config.Config; +import org.traccar.config.Keys; import org.traccar.helper.UnitsConverter; import jakarta.json.JsonArray; @@ -28,9 +30,10 @@ public class OverpassSpeedLimitProvider implements SpeedLimitProvider { private final Client client; private final String url; - public OverpassSpeedLimitProvider(Client client, String url) { + public OverpassSpeedLimitProvider(Config config, Client client, String url) { + int accuracy = config.getInteger(Keys.SPEED_LIMIT_ACCURACY); this.client = client; - this.url = url + "?data=[out:json];way[maxspeed](around:100.0,%f,%f);out%%20tags;"; + this.url = url + "?data=[out:json];way[maxspeed](around:" + accuracy + ",%f,%f);out%%20tags;"; } private Double parseSpeed(String value) { |