aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-11-11 09:21:45 +1300
committerGitHub <noreply@github.com>2017-11-11 09:21:45 +1300
commit204b1074ee57960775066c7c483d54bab8ebf279 (patch)
treebfec39fe84b547dac991f0d38cd69e9c64c688a6 /src/org/traccar/reports
parent92f00d0da0dafd08ccf2a623406963e61fcde276 (diff)
parent96d89e2e352f5cba70a346b1f71bfb3bd399556b (diff)
downloadtrackermap-server-204b1074ee57960775066c7c483d54bab8ebf279.tar.gz
trackermap-server-204b1074ee57960775066c7c483d54bab8ebf279.tar.bz2
trackermap-server-204b1074ee57960775066c7c483d54bab8ebf279.zip
Merge pull request #3632 from Abyss777/retry_geocoding
Retry geocoding for trips/stops
Diffstat (limited to 'src/org/traccar/reports')
-rw-r--r--src/org/traccar/reports/ReportUtils.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java
index f6f386e99..e04f2f90c 100644
--- a/src/org/traccar/reports/ReportUtils.java
+++ b/src/org/traccar/reports/ReportUtils.java
@@ -190,13 +190,23 @@ public final class ReportUtils {
trip.setStartLat(startTrip.getLatitude());
trip.setStartLon(startTrip.getLongitude());
trip.setStartTime(startTrip.getFixTime());
- trip.setStartAddress(startTrip.getAddress());
+ String startAddress = startTrip.getAddress();
+ if (startAddress == null && Context.getGeocoder() != null
+ && Context.getConfig().getBoolean("geocoder.onRequest")) {
+ startAddress = Context.getGeocoder().getAddress(startTrip.getLatitude(), startTrip.getLongitude(), null);
+ }
+ trip.setStartAddress(startAddress);
trip.setEndPositionId(endTrip.getId());
trip.setEndLat(endTrip.getLatitude());
trip.setEndLon(endTrip.getLongitude());
trip.setEndTime(endTrip.getFixTime());
- trip.setEndAddress(endTrip.getAddress());
+ String endAddress = endTrip.getAddress();
+ if (endAddress == null && Context.getGeocoder() != null
+ && Context.getConfig().getBoolean("geocoder.onRequest")) {
+ endAddress = Context.getGeocoder().getAddress(endTrip.getLatitude(), endTrip.getLongitude(), null);
+ }
+ trip.setEndAddress(endAddress);
trip.setDistance(calculateDistance(startTrip, endTrip, !ignoreOdometer));
trip.setDuration(tripDuration);
@@ -224,7 +234,13 @@ public final class ReportUtils {
stop.setLatitude(startStop.getLatitude());
stop.setLongitude(startStop.getLongitude());
stop.setStartTime(startStop.getFixTime());
- stop.setAddress(startStop.getAddress());
+ String address = startStop.getAddress();
+ if (address == null && Context.getGeocoder() != null
+ && Context.getConfig().getBoolean("geocoder.onRequest")) {
+ address = Context.getGeocoder().getAddress(stop.getLatitude(), stop.getLongitude(), null);
+ }
+ stop.setAddress(address);
+
stop.setEndTime(endStop.getFixTime());
long stopDuration = endStop.getFixTime().getTime() - startStop.getFixTime().getTime();