aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/MainModule.java6
-rw-r--r--src/main/java/org/traccar/geocoder/PlusCodesGeocoder.java (renamed from src/main/java/org/traccar/geocoder/TestGeocoder.java)7
2 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java
index 791d61c61..d1d3d4663 100644
--- a/src/main/java/org/traccar/MainModule.java
+++ b/src/main/java/org/traccar/MainModule.java
@@ -66,7 +66,7 @@ import org.traccar.geocoder.MapmyIndiaGeocoder;
import org.traccar.geocoder.NominatimGeocoder;
import org.traccar.geocoder.OpenCageGeocoder;
import org.traccar.geocoder.PositionStackGeocoder;
-import org.traccar.geocoder.TestGeocoder;
+import org.traccar.geocoder.PlusCodesGeocoder;
import org.traccar.geocoder.TomTomGeocoder;
import org.traccar.geolocation.GeolocationProvider;
import org.traccar.geolocation.GoogleGeolocationProvider;
@@ -211,8 +211,8 @@ public class MainModule extends AbstractModule {
int cacheSize = config.getInteger(Keys.GEOCODER_CACHE_SIZE);
Geocoder geocoder;
switch (type) {
- case "test":
- geocoder = new TestGeocoder();
+ case "pluscodes":
+ geocoder = new PlusCodesGeocoder();
break;
case "nominatim":
geocoder = new NominatimGeocoder(client, url, key, language, cacheSize, addressFormat);
diff --git a/src/main/java/org/traccar/geocoder/TestGeocoder.java b/src/main/java/org/traccar/geocoder/PlusCodesGeocoder.java
index 259f13c6c..5d003192f 100644
--- a/src/main/java/org/traccar/geocoder/TestGeocoder.java
+++ b/src/main/java/org/traccar/geocoder/PlusCodesGeocoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022 Anton Tananaev (anton@traccar.org)
+ * Copyright 2022 - 2024 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,9 +15,10 @@
*/
package org.traccar.geocoder;
+import com.google.openlocationcode.OpenLocationCode;
import org.traccar.database.StatisticsManager;
-public class TestGeocoder implements Geocoder {
+public class PlusCodesGeocoder implements Geocoder {
@Override
public void setStatisticsManager(StatisticsManager statisticsManager) {
@@ -25,7 +26,7 @@ public class TestGeocoder implements Geocoder {
@Override
public String getAddress(double latitude, double longitude, ReverseGeocoderCallback callback) {
- String address = String.format("Location %f, %f", latitude, longitude);
+ String address = new OpenLocationCode(latitude, longitude).getCode();
if (callback != null) {
callback.onSuccess(address);
return null;