Index: src/org/openstreetmap/josm/actions/MergeNodesAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 4311)
+++ src/org/openstreetmap/josm/actions/MergeNodesAction.java	(working copy)
@@ -93,21 +93,61 @@
      * @return the coordinates of this node are later used for the target node
      */
     public static Node selectTargetLocationNode(List<Node> candidates) {
-        if (! Main.pref.getBoolean("merge-nodes.average-location", false)) {
-            Node targetNode = null;
+        int size = candidates.size();
+        if (size == 0)
+            throw new IllegalArgumentException("empty list");
+
+        switch (Main.pref.getInteger("merge-nodes.mode", 0)) {
+        case 0: {
+            Node targetNode = candidates.get(size - 1);
             for (final Node n : candidates) { // pick last one
                 targetNode = n;
             }
             return targetNode;
         }
+        case 1: {
+            double lat = 0, lon = 0;
+            for (final Node n : candidates) {
+                lat += n.getCoor().lat();
+                lon += n.getCoor().lon();
+            }
 
-        double lat = 0, lon = 0;
-        for (final Node n : candidates) {
-            lat += n.getCoor().lat();
-            lon += n.getCoor().lon();
+            return new Node(new LatLon(lat / size, lon / size));  // TODO: not exact for long distances
         }
+        case 2: {
+            class WeightCoord {
+                LatLon latLon;
+                double weight;
+            }
 
-        return new Node(new LatLon(lat / candidates.size(), lon / candidates.size()));
+            List<WeightCoord> wcl = new ArrayList<WeightCoord>();
+            double weight = 0;
+            for (int i = 0; i < size; i++) {
+                for (int j = i + 1; j < size; j++) {
+                    final LatLon c1 = candidates.get(i).getCoor();
+                    final LatLon c2 = candidates.get(j).getCoor();
+
+                    WeightCoord wc = new WeightCoord();
+                    wc.latLon = c1.interpolate(c2, 0.5);
+                    wc.weight = c1.greatCircleDistance(c2);
+                    wcl.add(wc);
+                    weight += wc.weight;
+                }
+            }
+
+            double lat = 0, lon = 0;
+            for (final WeightCoord wc : wcl) {
+                lat += wc.latLon.lat() * wc.weight;
+                lon += wc.latLon.lon() * wc.weight;
+            }
+
+            return new Node(new LatLon(lat / weight, lon / weight)); // TODO: not exact for long distances
+        }
+        default:
+            throw new RuntimeException("unacceptable merge-nodes.mode");
+        }
+
+
     }
 
     /**
