aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/ReportUtils.java
diff options
context:
space:
mode:
authorShinryuken <watertext@hotmail.it>2017-11-19 11:22:31 +0100
committerGitHub <noreply@github.com>2017-11-19 11:22:31 +0100
commita5b273f8f8afd1a67613517c6487642601070456 (patch)
treebabc63f5d50977fc91b3946b1da2e86ec74c51a5 /src/org/traccar/reports/ReportUtils.java
parentc7928ef4a722cb40e9911c8e76e308fc48c85567 (diff)
parentfb9cbb2b74dc0060bd0dc5d0b3bfeb958ed6f3b5 (diff)
downloadtrackermap-server-a5b273f8f8afd1a67613517c6487642601070456.tar.gz
trackermap-server-a5b273f8f8afd1a67613517c6487642601070456.tar.bz2
trackermap-server-a5b273f8f8afd1a67613517c6487642601070456.zip
Merge branch 'master' into payload-as-form-param
Diffstat (limited to 'src/org/traccar/reports/ReportUtils.java')
-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();