Skip to content

Commit

Permalink
Make server URL configurable
Browse files Browse the repository at this point in the history
Advanced preference key `austriaaddresshelper.url`

See #12
  • Loading branch information
simon04 committed Aug 12, 2020
1 parent 1ac46e7 commit b7badb0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.openstreetmap.josm.data.osm.OsmPrimitive;
import org.openstreetmap.josm.data.osm.Relation;
import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.data.preferences.StringProperty;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.Notification;
import org.openstreetmap.josm.io.OverpassDownloadReader;
Expand All @@ -47,7 +48,8 @@
* Created by tom on 02/08/15.
*/
public class AustriaAddressHelperAction extends JosmAction {
static final String baseUrl = "https://bev-reverse-geocoder.thomaskonrad.at/reverse-geocode/json";
static final StringProperty baseUrl = new StringProperty("austriaaddresshelper.url",
"https://bev-reverse-geocoder.thomaskonrad.at/reverse-geocode/json");
static boolean addressTypeDialogCanceled = false;

protected static HashMap<HashMap<String, String>, String> rememberedAddressTypeChoices = new HashMap<>();
Expand Down Expand Up @@ -95,7 +97,7 @@ public static OsmPrimitive loadAddress(OsmPrimitive selectedObject){
LatLon center = selectedObject.getBBox().getCenter();

try {
URL url = new URL(baseUrl
URL url = new URL(baseUrl.get()
+ "?lat=" + URLEncoder.encode(DecimalDegreesCoordinateFormat.INSTANCE.latToString(center), "UTF-8")
+ "&lon=" + URLEncoder.encode(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(center), "UTF-8")
+ "&distance=30"
Expand Down

0 comments on commit b7badb0

Please sign in to comment.