Index: src/org/openstreetmap/josm/actions/AlignInCircleAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/AlignInCircleAction.java	(revision 17386)
+++ src/org/openstreetmap/josm/actions/AlignInCircleAction.java	(working copy)
@@ -13,6 +13,8 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
 import java.util.stream.Collectors;
 
 import javax.swing.JOptionPane;
@@ -29,6 +31,7 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon;
 import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon.JoinedWay;
+import org.openstreetmap.josm.data.validation.tests.CrossingWays;
 import org.openstreetmap.josm.data.validation.tests.SelfIntersectingWay;
 import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.tools.Geometry;
@@ -42,6 +45,7 @@
  * @author Petr Dlouhý
  * @author Teemu Koskinen
  * @author Alain Delplanque
+ * @author Gerd Petermann
  *
  * @since 146
  */
@@ -146,7 +150,7 @@
      */
     public static Command buildCommand(DataSet ds) throws InvalidSelection {
         Collection<OsmPrimitive> sel = ds.getSelected();
-        List<Node> nodes = new LinkedList<>();
+        List<Node> selectedNodes = new LinkedList<>();
         // fixNodes: All nodes for which the angle relative to center should not be modified
         Set<Node> fixNodes = new HashSet<>();
         List<Way> ways = new LinkedList<>();
@@ -155,79 +159,86 @@
 
         for (OsmPrimitive osm : sel) {
             if (osm instanceof Node) {
-                nodes.add((Node) osm);
+                selectedNodes.add((Node) osm);
             } else if (osm instanceof Way) {
                 ways.add((Way) osm);
             }
         }
 
-        if (ways.size() == 1 && !ways.get(0).isClosed()) {
+        // nodes on selected ways
+        List<Node> onWay = new ArrayList<>();
+        if (!ways.isEmpty()) {
+            List<Node> potentialCenter = new ArrayList<>();
+            for (Node n : selectedNodes) {
+                if (ways.stream().anyMatch(w -> w.containsNode(n))) {
+                    onWay.add(n);
+                } else {
+                    potentialCenter.add(n);
+                }
+            }
+            if (potentialCenter.size() == 1) {
+                // center is given
+                center = potentialCenter.get(0).getEastNorth();
+                if (onWay.size() == 1) {
+                    radius = center.distance(onWay.get(0).getEastNorth());
+                }
+            } else if (potentialCenter.size() > 1) {
+                throw new InvalidSelection(tr("Please select only one node as center."));
+            }
+
+        }
+
+        final List<Node> nodes;
+        if (ways.isEmpty()) {
+            nodes = sortByAngle(selectedNodes);
+            fixNodes.addAll(nodes);
+        } else if (ways.size() == 1 && !ways.get(0).isClosed()) {
             // Case 1
             Way w = ways.get(0);
-            if (SelfIntersectingWay.isSelfIntersecting(w)) {
-                throw new InvalidSelection(tr("Self-intersecting way"));
-            }
-
             fixNodes.add(w.firstNode());
             fixNodes.add(w.lastNode());
-            fixNodes.addAll(nodes);
-            fixNodes.addAll(collectNodesWithExternReferrers(ways));
+            fixNodes.addAll(onWay);
             // Temporary closed way used to reorder nodes
             Way closedWay = new Way(w);
-            closedWay.addNode(w.firstNode());
-            nodes = collectNodesAnticlockwise(Collections.singletonList(closedWay));
-            closedWay.setNodes(null); // see #19885
-        } else if (!ways.isEmpty() && checkWaysArePolygon(ways)) {
-            // Case 2
-            List<Node> inside = new ArrayList<>();
-            List<Node> outside = new ArrayList<>();
-
-            for (Node n: nodes) {
-                boolean isInside = ways.stream().anyMatch(w -> w.getNodes().contains(n));
-                if (isInside)
-                    inside.add(n);
-                else
-                    outside.add(n);
+            try {
+                closedWay.addNode(w.firstNode());
+                nodes = collectNodesAnticlockwise(Collections.singletonList(closedWay));
+            } finally {
+                closedWay.setNodes(null); // see #19885
             }
-
-            if (outside.size() == 1 && inside.isEmpty()) {
-                center = outside.get(0).getEastNorth();
-            } else if (outside.size() == 1 && inside.size() == 1) {
-                center = outside.get(0).getEastNorth();
-                radius = center.distance(inside.get(0).getEastNorth());
-            } else if (inside.size() == 2 && outside.isEmpty()) {
-                // 2 nodes inside, define diameter
-                EastNorth en0 = inside.get(0).getEastNorth();
-                EastNorth en1 = inside.get(1).getEastNorth();
-                center = new EastNorth((en0.east() + en1.east()) / 2, (en0.north() + en1.north()) / 2);
+        } else if (Multipolygon.joinWays(ways).size() == 1) {
+            // Case 2:
+            if (onWay.size() == 2) {
+                // 2 way nodes define diameter
+                EastNorth en0 = onWay.get(0).getEastNorth();
+                EastNorth en1 = onWay.get(1).getEastNorth();
                 radius = en0.distance(en1) / 2;
+                if (center == null) {
+                    center = en0.getCenter(en1);
+                }
             }
-
-            fixNodes.addAll(inside);
-            fixNodes.addAll(collectNodesWithExternReferrers(ways));
+            fixNodes.addAll(onWay);
             nodes = collectNodesAnticlockwise(ways);
-            if (nodes.size() < 4) {
-                throw new InvalidSelection(tr("Not enough nodes in selected ways."));
-            }
-        } else if (ways.isEmpty() && nodes.size() > 3) {
-            // Case 3
-            fixNodes.addAll(nodes);
-            // No need to reorder nodes since all are fix
         } else {
-            if (ways.isEmpty() && nodes.size() <= 3)
-                throw new InvalidSelection(tr("Please select at least four nodes."));
             throw new InvalidSelection();
         }
+        fixNodes.addAll(collectNodesWithExternReferrers(ways));
 
         // Check if one or more nodes are outside of download area
         if (nodes.stream().anyMatch(Node::isOutsideDownloadArea))
             throw new InvalidSelection(tr("One or more nodes involved in this action is outside of the downloaded area."));
 
+
         if (center == null) {
-            // Compute the center of nodes
-            center = Geometry.getCenter(nodes);
+            if (nodes.size() < 4) {
+                throw new InvalidSelection(tr("Not enough nodes to calculate center."));
+            }
+            if (validateGeometry(nodes)) {
+                // Compute the center of nodes
+                center = Geometry.getCenter(nodes);
+            }
             if (center == null) {
-                throw new InvalidSelection(tr("Cannot determine center of selected nodes."));
+                throw new InvalidSelection(tr("Cannot determine center of circle for this geometry."));
             }
         }
 
@@ -285,6 +296,38 @@
         return new SequenceCommand(tr("Align Nodes in Circle"), cmds);
     }
 
+    private static List<Node> sortByAngle(final List<Node> nodes) {
+        EastNorth sum = new EastNorth(0, 0);
+        for (Node n : nodes) {
+            EastNorth en = n.getEastNorth();
+            sum = sum.add(en.east(), en.north());
+        }
+        final EastNorth simpleCenter = new EastNorth(sum.east()/nodes.size(), sum.north()/nodes.size());
+
+        SortedMap<Double, List<Node>> orderedMap = new TreeMap<>();
+        for (Node n : nodes) {
+            double angle = new PolarCoor(n.getEastNorth(), simpleCenter).angle;
+            orderedMap.computeIfAbsent(angle, k-> new ArrayList<>()).add(n);
+        }
+        return orderedMap.values().stream().flatMap(List<Node>::stream).collect(Collectors.toList());
+    }
+
+    private static boolean validateGeometry(List<Node> nodes) {
+        Way test = new Way();
+        test.setNodes(nodes);
+        if (!test.isClosed()) {
+            test.addNode(test.firstNode());
+        }
+
+        try {
+            if (CrossingWays.isSelfCrossing(test))
+                return false;
+            return !SelfIntersectingWay.isSelfIntersecting(test);
+        } finally {
+            test.setNodes(null); // see #19855
+        }
+    }
+
     /**
      * Collect all nodes with more than one referrer.
      * @param ways Ways from witch nodes are selected
@@ -303,9 +346,9 @@
     private static List<Node> collectNodesAnticlockwise(List<Way> ways) throws InvalidSelection {
         Collection<JoinedWay> rings = Multipolygon.joinWays(ways);
         if (rings.size() != 1)
-            throw new InvalidSelection();
+            throw new InvalidSelection(); // we should never get here
         List<Node> nodes = new ArrayList<>(rings.iterator().next().getNodes());
-        if (nodes.get(0) != nodes.get(nodes.size()-1))
+        if (nodes.get(0) != nodes.get(nodes.size() - 1))
             throw new InvalidSelection();
         if (Geometry.isClockwise(nodes))
             Collections.reverse(nodes);
@@ -323,25 +366,4 @@
     protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
         updateEnabledStateOnModifiableSelection(selection);
     }
-
-    /**
-     * Determines if ways can be joined into a single polygon.
-     * @param ways The ways collection to check
-     * @return true if all ways can be joined into a single polygon
-     */
-    private static boolean checkWaysArePolygon(Collection<Way> ways) {
-        if (Multipolygon.joinWays(ways).size() != 1)
-            return false;
-        // For each way, nodes strictly between first and last should't be reference by an other way
-        for (Way way: ways) {
-            for (Node node: way.getNodes()) {
-                if (way.isFirstLastNode(node)) continue;
-                if (ways.stream().filter(wayOther -> way != wayOther).anyMatch(wayOther -> node.getReferrers().contains(wayOther))) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
 }
Index: src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
===================================================================
--- src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java	(revision 17386)
+++ src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java	(working copy)
@@ -26,6 +26,7 @@
 import org.openstreetmap.josm.data.validation.TestError;
 import org.openstreetmap.josm.data.validation.util.ValUtil;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
+import org.openstreetmap.josm.tools.CheckParameterUtil;
 import org.openstreetmap.josm.tools.Logging;
 
 /**
@@ -468,4 +469,17 @@
         }
     }
 
+    /**
+     * Check if the given way is self crossing
+     * @param way the way to check
+     * @return {@code true} if one or more segments of the way are crossing
+     * @see SelfIntersectingWay
+     * @since xxx
+     */
+    public static boolean isSelfCrossing(Way way) {
+        CheckParameterUtil.ensureParameterNotNull(way, "way");
+        SelfCrossing test = new SelfCrossing();
+        test.visit(way);
+        return !test.getErrors().isEmpty();
+    }
 }
Index: test/data/alignCircleCases.osm
===================================================================
--- test/data/alignCircleCases.osm	(nonexistent)
+++ test/data/alignCircleCases.osm	(working copy)
@@ -0,0 +1,1033 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' upload='never' generator='JOSM'>
+  <bounds minlat='37.5554811' minlon='14.4612697' maxlat='37.556938' maxlon='14.4630077' origin='CGImap 0.8.3 (2936052 spike-07.openstreetmap.org)' />
+  <bounds minlat='37.5554811' minlon='14.4612697' maxlat='37.556938' maxlon='14.4630077' origin='OpenStreetMap server' />
+  <node id='-177365' action='modify' lat='37.55691419926' lon='14.46148123867' />
+  <node id='-177366' action='modify' lat='37.55684485074' lon='14.46155150259' />
+  <node id='-177367' action='modify' lat='37.55687312689' lon='14.46152268691'>
+    <tag k='sel' v='1' />
+  </node>
+  <node id='-177368' action='modify' lat='37.55686036859' lon='14.4615670012' />
+  <node id='-177369' action='modify' lat='37.5568796806' lon='14.46157247181' />
+  <node id='-177370' action='modify' lat='37.55689896179' lon='14.46156683088' />
+  <node id='-177371' action='modify' lat='37.55691439329' lon='14.46155119569' />
+  <node id='-177372' action='modify' lat='37.55692291869' lon='14.46152866297' />
+  <node id='-177373' action='modify' lat='37.55692284944' lon='14.4615036956' />
+  <node id='-177374' action='modify' lat='37.55689868142' lon='14.46146574006' />
+  <node id='-177375' action='modify' lat='37.55687936941' lon='14.46146026946' />
+  <node id='-177376' action='modify' lat='37.55686008821' lon='14.46146591038' />
+  <node id='-177377' action='modify' lat='37.55684465671' lon='14.46148154557' />
+  <node id='-177378' action='modify' lat='37.5568361313' lon='14.4615040783' />
+  <node id='-177379' action='modify' lat='37.55683620055' lon='14.46152904567' />
+  <node id='-177380' action='modify' lat='37.55691716886' lon='14.46163544625'>
+    <tag k='sel' v='2' />
+  </node>
+  <node id='-177381' action='modify' lat='37.55684048956' lon='14.4617253193' />
+  <node id='-177382' action='modify' lat='37.55685600743' lon='14.46174081791' />
+  <node id='-177383' action='modify' lat='37.55687531944' lon='14.46174628852' />
+  <node id='-177384' action='modify' lat='37.55689460063' lon='14.46174064759' />
+  <node id='-177385' action='modify' lat='37.55691003212' lon='14.4617250124' />
+  <node id='-177386' action='modify' lat='37.55691855752' lon='14.46170247968' />
+  <node id='-177387' action='modify' lat='37.55691848827' lon='14.46167751231' />
+  <node id='-177388' action='modify' lat='37.5569098381' lon='14.46165505538' />
+  <node id='-177389' action='modify' lat='37.55689432026' lon='14.46163955677' />
+  <node id='-177390' action='modify' lat='37.55687500825' lon='14.46163408617' />
+  <node id='-177391' action='modify' lat='37.55685572705' lon='14.46163972709' />
+  <node id='-177392' action='modify' lat='37.55684029554' lon='14.46165536228' />
+  <node id='-177393' action='modify' lat='37.55683177013' lon='14.46167789501' />
+  <node id='-177394' action='modify' lat='37.55683183938' lon='14.46170286238' />
+  <node id='-177395' action='modify' lat='37.55674469778' lon='14.46135781442'>
+    <tag k='sel' v='3' />
+  </node>
+  <node id='-177396' action='modify' lat='37.55671642158' lon='14.4613866301' />
+  <node id='-177397' action='modify' lat='37.55673193945' lon='14.46140212871' />
+  <node id='-177398' action='modify' lat='37.5567512515' lon='14.46140759931' />
+  <node id='-177399' action='modify' lat='37.55677053272' lon='14.46140195839' />
+  <node id='-177400' action='modify' lat='37.55678596424' lon='14.4613863232' />
+  <node id='-177401' action='modify' lat='37.55679448966' lon='14.46136379047'>
+    <tag k='sel' v='3' />
+  </node>
+  <node id='-177402' action='modify' lat='37.55679442042' lon='14.4613388231' />
+  <node id='-177403' action='modify' lat='37.55678577022' lon='14.46131636618' />
+  <node id='-177404' action='modify' lat='37.55677025235' lon='14.46130086757' />
+  <node id='-177405' action='modify' lat='37.55675094031' lon='14.46129539696' />
+  <node id='-177406' action='modify' lat='37.55673165908' lon='14.46130103789' />
+  <node id='-177407' action='modify' lat='37.55671622756' lon='14.46131667308' />
+  <node id='-177408' action='modify' lat='37.55670770212' lon='14.4613392058' />
+  <node id='-177409' action='modify' lat='37.55670777137' lon='14.46136417318' />
+  <node id='-177410' action='modify' lat='37.55653956697' lon='14.46209010402' />
+  <node id='-177411' action='modify' lat='37.55658630124' lon='14.46210554382' />
+  <node id='-177412' action='modify' lat='37.55665195171' lon='14.46208519136' />
+  <node id='-177413' action='modify' lat='37.55675376546' lon='14.46201079963' />
+  <node id='-177414' action='modify' lat='37.55655681414' lon='14.46216660118' />
+  <node id='-177415' action='modify' lat='37.55660354841' lon='14.46218204098' />
+  <node id='-177416' action='modify' lat='37.55666919885' lon='14.46216168852'>
+    <tag k='sel' v='41' />
+  </node>
+  <node id='-177417' action='modify' lat='37.55677101258' lon='14.46208729679' />
+  <node id='-177418' action='modify' lat='37.55683731449' lon='14.46239008267' />
+  <node id='-177419' action='modify' lat='37.5566402416' lon='14.46279572753' />
+  <node id='-177420' action='modify' lat='37.55671231689' lon='14.46237870724' />
+  <node id='-177421' action='modify' lat='37.55671347821' lon='14.46241863738' />
+  <node id='-177422' action='modify' lat='37.55671081506' lon='14.46245223115' />
+  <node id='-177423' action='modify' lat='37.55668951053' lon='14.46251269911' />
+  <node id='-177424' action='modify' lat='37.55666953692' lon='14.46255133196' />
+  <node id='-177425' action='modify' lat='37.55663624754' lon='14.46258492574' />
+  <node id='-177426' action='modify' lat='37.5565822772' lon='14.46260879036' />
+  <node id='-177427' action='modify' lat='37.5568586203' lon='14.46265715236' />
+  <node id='-177428' action='modify' lat='37.55657189412' lon='14.46236592807' />
+  <node id='-177429' action='modify' lat='37.55644583135' lon='14.46235648889' />
+  <node id='-177430' action='modify' lat='37.55644733048' lon='14.46237908049' />
+  <node id='-177431' action='modify' lat='37.55645381458' lon='14.4624002242' />
+  <node id='-177432' action='modify' lat='37.55646475836' lon='14.4624182071' />
+  <node id='-177433' action='modify' lat='37.55647927522' lon='14.4624315723' />
+  <node id='-177434' action='modify' lat='37.55649618907' lon='14.46243923705' />
+  <node id='-177435' action='modify' lat='37.55651412967' lon='14.46244058038' />
+  <node id='-177436' action='modify' lat='37.55652895376' lon='14.46243682061' />
+  <node id='-177437' action='modify' lat='37.55654731191' lon='14.46242438845' />
+  <node id='-177438' action='modify' lat='37.55656092621' lon='14.46240612819' />
+  <node id='-177439' action='modify' lat='37.55656828681' lon='14.46238813732' />
+  <node id='-177440' action='modify' lat='37.556570395' lon='14.46234333647' />
+  <node id='-177441' action='modify' lat='37.55656391091' lon='14.46232219276' />
+  <node id='-177442' action='modify' lat='37.55655296714' lon='14.46230420986' />
+  <node id='-177443' action='modify' lat='37.5565384503' lon='14.46229084466' />
+  <node id='-177444' action='modify' lat='37.55652153645' lon='14.46228317991' />
+  <node id='-177445' action='modify' lat='37.55650359584' lon='14.46228183658' />
+  <node id='-177446' action='modify' lat='37.55648608194' lon='14.46228692348' />
+  <node id='-177447' action='modify' lat='37.55647041359' lon='14.46229802851' />
+  <node id='-177448' action='modify' lat='37.55645786016' lon='14.46231425201' />
+  <node id='-177449' action='modify' lat='37.55644943867' lon='14.46233427964' />
+  <node id='-177450' action='modify' lat='37.55677883754' lon='14.46238476096' />
+  <node id='-177451' action='modify' lat='37.55678338581' lon='14.46246734835' />
+  <node id='-177452' action='modify' lat='37.55675262917' lon='14.46256661489' />
+  <node id='-177453' action='modify' lat='37.55671281242' lon='14.46262355942' />
+  <node id='-177454' action='modify' lat='37.55667952306' lon='14.46265211413' />
+  <node id='-177455' action='modify' lat='37.55664894294' lon='14.46267308698' />
+  <node id='-177456' action='modify' lat='37.5566230771' lon='14.46274037141' />
+  <node id='-177457' action='modify' lat='37.55644192824' lon='14.46154801513' />
+  <node id='-177458' action='modify' lat='37.55635456852' lon='14.46128700605' />
+  <node id='-177459' action='modify' lat='37.55646581605' lon='14.46148487984' />
+  <node id='-177460' action='modify' lat='37.55648104734' lon='14.46176525798' />
+  <node id='-177461' action='modify' lat='37.55637416104' lon='14.46139356747' />
+  <node id='-177462' action='modify' lat='37.55648073615' lon='14.46165305563' />
+  <node id='-177463' action='modify' lat='37.5565285776' lon='14.46152266506' />
+  <node id='-177464' action='modify' lat='37.55633528719' lon='14.46129264697' />
+  <node id='-177465' action='modify' lat='37.55643749781' lon='14.46169686447' />
+  <node id='-177466' action='modify' lat='37.55631139935' lon='14.46135578226' />
+  <node id='-177467' action='modify' lat='37.55650032863' lon='14.46175961706' />
+  <node id='-177468' action='modify' lat='37.55650468982' lon='14.46158580035' />
+  <node id='-177469' action='modify' lat='37.55647885479' lon='14.46154165637'>
+    <tag k='sel' v='11' />
+  </node>
+  <node id='-177470' action='modify' lat='37.55638959263' lon='14.46137793228' />
+  <node id='-177471' action='modify' lat='37.55652421641' lon='14.46169648177' />
+  <node id='-177472' action='modify' lat='37.55638939861' lon='14.46130797526' />
+  <node id='-177473' action='modify' lat='37.55644621729' lon='14.46174428876' />
+  <node id='-177474' action='modify' lat='37.556441859' lon='14.46152304776' />
+  <node id='-177475' action='modify' lat='37.55643756705' lon='14.46172183184' />
+  <node id='-177476' action='modify' lat='37.55648509734' lon='14.46147923892' />
+  <node id='-177477' action='modify' lat='37.55633556756' lon='14.46139373779' />
+  <node id='-177478' action='modify' lat='37.55652864684' lon='14.46154763243' />
+  <node id='-177479' action='modify' lat='37.55651556618' lon='14.46167402484' />
+  <node id='-177480' action='modify' lat='37.55637388066' lon='14.46129247665' />
+  <node id='-177481' action='modify' lat='37.55646173522' lon='14.46175978737' />
+  <node id='-177482' action='modify' lat='37.55651992737' lon='14.46150020813' />
+  <node id='-177483' action='modify' lat='37.55646145485' lon='14.46165869655' />
+  <node id='-177484' action='modify' lat='37.55631985558' lon='14.46130828216' />
+  <node id='-177485' action='modify' lat='37.55648540853' lon='14.46159144127' />
+  <node id='-177486' action='modify' lat='37.55635487971' lon='14.4613992084' />
+  <node id='-177487' action='modify' lat='37.55651576021' lon='14.46174398186' />
+  <node id='-177488' action='modify' lat='37.5563981181' lon='14.46135539956'>
+    <tag k='sel' v='13' />
+  </node>
+  <node id='-177489' action='modify' lat='37.55634832596' lon='14.4613494235'>
+    <tag k='sel' v='13' />
+  </node>
+  <node id='-177490' action='modify' lat='37.55645057848' lon='14.46157047206' />
+  <node id='-177491' action='modify' lat='37.55645038446' lon='14.46150051503' />
+  <node id='-177492' action='modify' lat='37.55644602327' lon='14.46167433174' />
+  <node id='-177493' action='modify' lat='37.55650440945' lon='14.46148470952' />
+  <node id='-177494' action='modify' lat='37.5563113301' lon='14.46133081489' />
+  <node id='-177495' action='modify' lat='37.55652428566' lon='14.46172144914' />
+  <node id='-177496' action='modify' lat='37.55652012139' lon='14.46157016515' />
+  <node id='-177497' action='modify' lat='37.55639804885' lon='14.46133043219' />
+  <node id='-177498' action='modify' lat='37.55650004826' lon='14.46165852623' />
+  <node id='-177499' action='modify' lat='37.55652289699' lon='14.46165441572'>
+    <tag k='sel' v='12' />
+  </node>
+  <node id='-177500' action='modify' lat='37.55646609642' lon='14.46158597066' />
+  <node id='-177501' action='modify' lat='37.5563200496' lon='14.46137823918' />
+  <node id='-177502' action='modify' lat='37.5558815644' lon='14.46196208882' />
+  <node id='-177503' action='modify' lat='37.55599395013' lon='14.46195717616' />
+  <node id='-177504' action='modify' lat='37.55609576478' lon='14.46188278442' />
+  <node id='-177505' action='modify' lat='37.55601820525' lon='14.46153058085' />
+  <node id='-177506' action='modify' lat='37.55603372327' lon='14.46154607946' />
+  <node id='-177507' action='modify' lat='37.55601801123' lon='14.46146062383' />
+  <node id='-177508' action='modify' lat='37.5560530355' lon='14.46155155006' />
+  <node id='-177509' action='modify' lat='37.55608755454' lon='14.46146031692' />
+  <node id='-177510' action='modify' lat='37.55605272431' lon='14.46143934771' />
+  <node id='-177511' action='modify' lat='37.5560723169' lon='14.46154590914' />
+  <node id='-177512' action='modify' lat='37.5560334429' lon='14.46144498863' />
+  <node id='-177513' action='modify' lat='37.55609620482' lon='14.46148277385' />
+  <node id='-177514' action='modify' lat='37.55600955497' lon='14.46150812392' />
+  <node id='-177515' action='modify' lat='37.55607203653' lon='14.46144481831' />
+  <node id='-177516' action='modify' lat='37.55600948572' lon='14.46148315655' />
+  <node id='-177517' action='modify' lat='37.55687368078' lon='14.46132837434' />
+  <node id='-177518' action='modify' lat='37.55688919862' lon='14.46134387295' />
+  <node id='-177519' action='modify' lat='37.55690851062' lon='14.46134934356' />
+  <node id='-177520' action='modify' lat='37.55692779181' lon='14.46134370263' />
+  <node id='-177521' action='modify' lat='37.5569432233' lon='14.46132806744' />
+  <node id='-177522' action='modify' lat='37.55695174869' lon='14.46130553472' />
+  <node id='-177523' action='modify' lat='37.55694577554' lon='14.46128304982' />
+  <node id='-177524' action='modify' lat='37.55694302927' lon='14.46125811042' />
+  <node id='-177525' action='modify' lat='37.55692751144' lon='14.46124261181' />
+  <node id='-177526' action='modify' lat='37.55690819943' lon='14.46123714121' />
+  <node id='-177527' action='modify' lat='37.55688891825' lon='14.46124278213' />
+  <node id='-177528' action='modify' lat='37.55687348675' lon='14.46125841732' />
+  <node id='-177529' action='modify' lat='37.55686496134' lon='14.46128095005' />
+  <node id='-177530' action='modify' lat='37.55686503059' lon='14.46130591742' />
+  <node id='-177531' action='modify' lat='37.55587222611' lon='14.46211553776' />
+  <node id='-177532' action='modify' lat='37.555954882' lon='14.46205099363' />
+  <node id='-177533' action='modify' lat='37.55604737777' lon='14.46209319556' />
+  <node id='-177534' action='modify' lat='37.55611035355' lon='14.4620013443' />
+  <node id='-177535' action='modify' lat='37.55611232154' lon='14.46220242409' />
+  <node id='-177536' action='modify' lat='37.55591158607' lon='14.46251769735' />
+  <node id='-177537' action='modify' lat='37.55589190609' lon='14.46220490656' />
+  <node id='-177538' action='modify' lat='37.55613987343' lon='14.46239853895' />
+  <node id='-177539' action='modify' lat='37.55613003347' lon='14.46261327231' />
+  <node id='-177540' action='modify' lat='37.55592929804' lon='14.46292854557' />
+  <node id='-177541' action='modify' lat='37.55590961807' lon='14.46261575478' />
+  <node id='-177542' action='modify' lat='37.55615758535' lon='14.46280938717' />
+  <node id='-177543' action='modify' lat='37.55605578204' lon='14.46272989105' />
+  <node id='-177544' action='modify' lat='37.55582527409' lon='14.4626846841' />
+  <node id='-177545' action='modify' lat='37.55575467839' lon='14.46279691764' />
+  <node id='-177546' action='modify' lat='37.55563124764' lon='14.46298919602' />
+  <node id='-177547' action='modify' lat='37.55560452949' lon='14.46267748134' />
+  <node id='-177548' action='modify' lat='37.5558614152' lon='14.4628783235' />
+  <node id='-177549' action='modify' lat='37.55578760212' lon='14.46224090232' />
+  <node id='-177550' action='modify' lat='37.55558686577' lon='14.46255617558' />
+  <node id='-177551' action='modify' lat='37.55556718571' lon='14.46224338479' />
+  <node id='-177552' action='modify' lat='37.55581515413' lon='14.46243701719' />
+  <node id='-177553' action='modify' lat='37.55644611869' lon='14.46138381242' />
+  <node id='-177554' action='modify' lat='37.55646163663' lon='14.46139931103' />
+  <node id='-177555' action='modify' lat='37.55648094875' lon='14.46140478164' />
+  <node id='-177556' action='modify' lat='37.55650023004' lon='14.46139914071' />
+  <node id='-177557' action='modify' lat='37.55651566162' lon='14.46138350552' />
+  <node id='-177558' action='modify' lat='37.55652418706' lon='14.4613609728' />
+  <node id='-177559' action='modify' lat='37.55651821387' lon='14.46133848789' />
+  <node id='-177560' action='modify' lat='37.55651546759' lon='14.4613135485' />
+  <node id='-177561' action='modify' lat='37.55649994967' lon='14.46129804989' />
+  <node id='-177562' action='modify' lat='37.55648063755' lon='14.46129257929' />
+  <node id='-177563' action='modify' lat='37.55646135625' lon='14.46129822021' />
+  <node id='-177564' action='modify' lat='37.55644592466' lon='14.4613138554' />
+  <node id='-177565' action='modify' lat='37.55643739921' lon='14.46133638813' />
+  <node id='-177566' action='modify' lat='37.55643746846' lon='14.4613613555' />
+  <node id='-177567' action='modify' lat='37.556716745' lon='14.46156434474' />
+  <node id='-177568' action='modify' lat='37.55673226287' lon='14.46157984335' />
+  <node id='-177569' action='modify' lat='37.55675157492' lon='14.46158531395' />
+  <node id='-177570' action='modify' lat='37.55677085614' lon='14.46157967303' />
+  <node id='-177571' action='modify' lat='37.55678628766' lon='14.46156403784' />
+  <node id='-177572' action='modify' lat='37.55679481308' lon='14.46154150511'>
+    <tag k='sel' v='4' />
+  </node>
+  <node id='-177573' action='modify' lat='37.55679474384' lon='14.46151653774' />
+  <node id='-177574' action='modify' lat='37.55678012633' lon='14.46150160818' />
+  <node id='-177575' action='modify' lat='37.55677057577' lon='14.46147858221' />
+  <node id='-177576' action='modify' lat='37.55675126373' lon='14.4614731116' />
+  <node id='-177577' action='modify' lat='37.5567319825' lon='14.46147875253' />
+  <node id='-177578' action='modify' lat='37.55671655098' lon='14.46149438772' />
+  <node id='-177579' action='modify' lat='37.55670802555' lon='14.46151692044'>
+    <tag k='sel' v='4' />
+  </node>
+  <node id='-177580' action='modify' lat='37.5567080948' lon='14.46154188782' />
+  <node id='-177581' action='modify' lat='37.55640207453' lon='14.46151110796' />
+  <node id='-177582' action='modify' lat='37.5563867939' lon='14.46149617839' />
+  <node id='-177583' action='modify' lat='37.55637790634' lon='14.46147315242' />
+  <node id='-177584' action='modify' lat='37.55635859419' lon='14.46146768182' />
+  <node id='-177585' action='modify' lat='37.55633931287' lon='14.46147332274' />
+  <node id='-177586' action='modify' lat='37.55632388126' lon='14.46148895793' />
+  <node id='-177587' action='modify' lat='37.55631535579' lon='14.46151149066'>
+    <tag k='sel' v='14' />
+  </node>
+  <node id='-177588' action='modify' lat='37.55637818671' lon='14.46157424325' />
+  <node id='-177589' action='modify' lat='37.55639361831' lon='14.46155860805' />
+  <node id='-177590' action='modify' lat='37.55640214377' lon='14.46153607533'>
+    <tag k='sel' v='14' />
+  </node>
+  <node id='-177591' action='modify' lat='37.55631542503' lon='14.46153645803' />
+  <node id='-177592' action='modify' lat='37.55632407528' lon='14.46155891496' />
+  <node id='-177593' action='modify' lat='37.55633959324' lon='14.46157441356' />
+  <node id='-177594' action='modify' lat='37.55635890538' lon='14.46157988417' />
+  <node id='-177595' action='modify' lat='37.55605448327' lon='14.4613042381'>
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='20' />
+  </node>
+  <node id='-177596' action='modify' lat='37.5558489401' lon='14.46128918337' />
+  <node id='-177597' action='modify' lat='37.55584363576' lon='14.46140293022' />
+  <node id='-177598' action='modify' lat='37.55578130964' lon='14.4614129667' />
+  <node id='-177599' action='modify' lat='37.55577335312' lon='14.46129420161' />
+  <node id='-177600' action='modify' lat='37.55571746794' lon='14.46144177661' />
+  <node id='-177601' action='modify' lat='37.5555167314' lon='14.46175704987' />
+  <node id='-177602' action='modify' lat='37.55549705132' lon='14.46144425908' />
+  <node id='-177603' action='modify' lat='37.55574501997' lon='14.46163789148' />
+  <node id='-177604' action='modify' lat='37.55575879599' lon='14.4618811732' />
+  <node id='-177605' action='modify' lat='37.55568454418' lon='14.46199779193' />
+  <node id='-177606' action='modify' lat='37.55555805956' lon='14.46219644646' />
+  <node id='-177607' action='modify' lat='37.55553837949' lon='14.46188365567' />
+  <node id='-177608' action='modify' lat='37.555786348' lon='14.46207728806' />
+  <node id='-177609' action='modify' lat='37.55675310861' lon='14.46175472442' />
+  <node id='-177610' action='modify' lat='37.55671827868' lon='14.46173375521' />
+  <node id='-177611' action='modify' lat='37.55673379656' lon='14.46174925382' />
+  <node id='-177612' action='modify' lat='37.55678782135' lon='14.46173344831' />
+  <node id='-177613' action='modify' lat='37.55677238983' lon='14.4617490835' />
+  <node id='-177614' action='modify' lat='37.55670962848' lon='14.46171129829' />
+  <node id='-177615' action='modify' lat='37.55679627752' lon='14.46168594821'>
+    <tag k='sel' v='5' />
+  </node>
+  <node id='-177616' action='modify' lat='37.55673351619' lon='14.461648163' />
+  <node id='-177617' action='modify' lat='37.55679634676' lon='14.46171091558'>
+    <tag k='sel' v='5' />
+  </node>
+  <node id='-177618' action='modify' lat='37.55675279742' lon='14.46164252207' />
+  <node id='-177619' action='modify' lat='37.55677210946' lon='14.46164799268'>
+    <tag k='sel' v='5' />
+  </node>
+  <node id='-177620' action='modify' lat='37.55670955923' lon='14.46168633091'>
+    <tag k='sel' v='5' />
+  </node>
+  <node id='-177621' action='modify' lat='37.55678166001' lon='14.46167101866' />
+  <node id='-177622' action='modify' lat='37.55671808466' lon='14.46166379819' />
+  <node id='-177623' action='modify' lat='37.55635782999' lon='14.46164914107' />
+  <node id='-177624' action='modify' lat='37.55632311706' lon='14.46167041719' />
+  <node id='-177625' action='modify' lat='37.55637742251' lon='14.4617557025' />
+  <node id='-177626' action='modify' lat='37.55633882903' lon='14.46175587282' />
+  <node id='-177627' action='modify' lat='37.55639285411' lon='14.46174006731' />
+  <node id='-177628' action='modify' lat='37.55632331108' lon='14.46174037421' />
+  <node id='-177629' action='modify' lat='37.55640131033' lon='14.46169256721'>
+    <tag k='sel' v='15' />
+  </node>
+  <node id='-177630' action='modify' lat='37.55631466083' lon='14.46171791729' />
+  <node id='-177631' action='modify' lat='37.55640137957' lon='14.46171753458'>
+    <tag k='sel' v='15' />
+  </node>
+  <node id='-177632' action='modify' lat='37.55638669274' lon='14.46167763766' />
+  <node id='-177633' action='modify' lat='37.55633854866' lon='14.461654782' />
+  <node id='-177634' action='modify' lat='37.55631459158' lon='14.46169294991'>
+    <tag k='sel' v='15' />
+  </node>
+  <node id='-177635' action='modify' lat='37.55637714213' lon='14.46165461168'>
+    <tag k='sel' v='15' />
+  </node>
+  <node id='-177636' action='modify' lat='37.55635814118' lon='14.46176134342' />
+  <node id='-177637' action='modify' lat='37.55660656928' lon='14.46128015712' />
+  <node id='-177638' action='modify' lat='37.55657229559' lon='14.46130125895' />
+  <node id='-177639' action='modify' lat='37.55662591633' lon='14.4613853016' />
+  <node id='-177640' action='modify' lat='37.55658790494' lon='14.4613854776' />
+  <node id='-177641' action='modify' lat='37.55664112636' lon='14.4613699233' />
+  <node id='-177642' action='modify' lat='37.55657260581' lon='14.46137024057' />
+  <node id='-177643' action='modify' lat='37.55664952202' lon='14.46132307658' />
+  <node id='-177644' action='modify' lat='37.5565640487' lon='14.4613481477' />
+  <node id='-177645' action='modify' lat='37.55665273282' lon='14.46135042447'>
+    <tag k='sel' v='7' />
+  </node>
+  <node id='-177646' action='modify' lat='37.55664099118' lon='14.46130087148' />
+  <node id='-177647' action='modify' lat='37.55658751983' lon='14.46128576501' />
+  <node id='-177648' action='modify' lat='37.55655624194' lon='14.46133124339'>
+    <tag k='sel' v='7' />
+  </node>
+  <node id='-177649' action='modify' lat='37.55662565772' lon='14.46128554989' />
+  <node id='-177650' action='modify' lat='37.55660692653' lon='14.46139085149' />
+  <node id='-177651' action='modify' lat='37.55660676548' lon='14.46133550421'>
+    <tag k='sel' v='7' />
+  </node>
+  <node id='-177652' action='modify' lat='37.55590697927' lon='14.46138712673' />
+  <node id='-177653' action='modify' lat='37.55597507195' lon='14.46131728109' />
+  <node id='-177654' action='modify' lat='37.55597559287' lon='14.46138630275' />
+  <node id='-177655' action='modify' lat='37.55598389844' lon='14.46136400694' />
+  <node id='-177656' action='modify' lat='37.55590645835' lon='14.46131810506' />
+  <node id='-177657' action='modify' lat='37.55589815277' lon='14.46134040087' />
+  <node id='-177658' action='modify' lat='37.55594060788' lon='14.46129685283' />
+  <node id='-177659' action='modify' lat='37.5559216104' lon='14.46130256294' />
+  <node id='-177660' action='modify' lat='37.55594144336' lon='14.46140755499' />
+  <node id='-177661' action='modify' lat='37.55595968808' lon='14.46130210567' />
+  <node id='-177662' action='modify' lat='37.55592236315' lon='14.46140230214' />
+  <node id='-177663' action='modify' lat='37.55589833868' lon='14.46136503442' />
+  <node id='-177664' action='modify' lat='37.5559282237' lon='14.46134925932'>
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='28' />
+  </node>
+  <node id='-177665' action='modify' lat='37.55596044083' lon='14.46140184487' />
+  <node id='-177666' action='modify' lat='37.55598371253' lon='14.46133937339' />
+  <node id='-177667' action='modify' lat='37.55595147095' lon='14.46137426998'>
+    <tag k='sel' v='28' />
+  </node>
+  <node id='-177668' action='modify' lat='37.55599573207' lon='14.46172257931' />
+  <node id='-177669' action='modify' lat='37.55601125009' lon='14.46173807792' />
+  <node id='-177670' action='modify' lat='37.55603056233' lon='14.46174354852' />
+  <node id='-177671' action='modify' lat='37.55604984374' lon='14.4617379076' />
+  <node id='-177672' action='modify' lat='37.55606527541' lon='14.46172227241' />
+  <node id='-177673' action='modify' lat='37.5560738009' lon='14.46169973968' />
+  <node id='-177674' action='modify' lat='37.55607373166' lon='14.46167477231' />
+  <node id='-177675' action='modify' lat='37.55605911401' lon='14.46165984275' />
+  <node id='-177676' action='modify' lat='37.55604956336' lon='14.46163681678' />
+  <node id='-177677' action='modify' lat='37.55603025114' lon='14.46163134617' />
+  <node id='-177678' action='modify' lat='37.55601096972' lon='14.4616369871' />
+  <node id='-177679' action='modify' lat='37.55599553805' lon='14.46165262229' />
+  <node id='-177680' action='modify' lat='37.55598701253' lon='14.46167515501' />
+  <node id='-177681' action='modify' lat='37.55598708178' lon='14.46170012239' />
+  <node id='-177682' action='modify' lat='37.55601928253' lon='14.46166005296' />
+  <node id='-177683' action='modify' lat='37.55605106444' lon='14.46168343898' />
+  <node id='-177684' action='modify' lat='37.55603305469' lon='14.46171551124' />
+  <node id='-177685' action='modify' lat='37.55601398554' lon='14.46171751576' />
+  <node id='-177686' action='modify' lat='37.55658065366' lon='14.4615602573' />
+  <node id='-177687' action='modify' lat='37.55657200344' lon='14.46153780038' />
+  <node id='-177688' action='modify' lat='37.55657193419' lon='14.46151283301' />
+  <node id='-177689' action='modify' lat='37.55658045963' lon='14.46149030028' />
+  <node id='-177690' action='modify' lat='37.55659589119' lon='14.46147466509' />
+  <node id='-177691' action='modify' lat='37.55661517245' lon='14.46146902417' />
+  <node id='-177692' action='modify' lat='37.55663448454' lon='14.46147449477' />
+  <node id='-177693' action='modify' lat='37.55665000242' lon='14.46148999338' />
+  <node id='-177694' action='modify' lat='37.5566527487' lon='14.46151493278'>
+    <tag k='sel' v='8' />
+  </node>
+  <node id='-177695' action='modify' lat='37.55665872188' lon='14.46153741768' />
+  <node id='-177696' action='modify' lat='37.55665019645' lon='14.4615599504' />
+  <node id='-177697' action='modify' lat='37.55663476491' lon='14.46157558559' />
+  <node id='-177698' action='modify' lat='37.55661548364' lon='14.46158122652' />
+  <node id='-177699' action='modify' lat='37.55659617156' lon='14.46157575591' />
+  <node id='-177757' action='modify' lat='37.55559309613' lon='14.46135720196' />
+  <node id='-177758' action='modify' lat='37.5555844458' lon='14.46133474504' />
+  <node id='-177759' action='modify' lat='37.55558437655' lon='14.46130977767' />
+  <node id='-177760' action='modify' lat='37.5555929021' lon='14.46128724494' />
+  <node id='-177761' action='modify' lat='37.55560833387' lon='14.46127160975' />
+  <node id='-177762' action='modify' lat='37.55564692773' lon='14.46127143943' />
+  <node id='-177763' action='modify' lat='37.55566244582' lon='14.46128693804' />
+  <node id='-177764' action='modify' lat='37.55566519213' lon='14.46131187744' />
+  <node id='-177765' action='modify' lat='37.55567116539' lon='14.46133436234' />
+  <node id='-177766' action='modify' lat='37.55566263985' lon='14.46135689506' />
+  <node id='-177767' action='modify' lat='37.5556472081' lon='14.46137253025' />
+  <node id='-177768' action='modify' lat='37.55562792658' lon='14.46137817118' />
+  <node id='-177769' action='modify' lat='37.55560861424' lon='14.46137270057' />
+  <node id='-177770' action='modify' lat='37.55554321044' lon='14.46127265293' />
+  <node id='-177771' action='modify' lat='37.55555329556' lon='14.46134213178' />
+  <node id='-177772' action='modify' lat='37.55554321044' lon='14.46140573917' />
+  <node id='-177773' action='modify' lat='37.55553545266' lon='14.46141846065' />
+  <node id='-177891' action='modify' lat='37.55623396697' lon='14.46128721202'>
+    <tag k='sel' v='60' />
+  </node>
+  <node id='-177892' action='modify' lat='37.55626250254' lon='14.46135120389'>
+    <tag k='sel' v='60' />
+  </node>
+  <node id='-177893' action='modify' lat='37.55621177263' lon='14.46138519958'>
+    <tag k='sel' v='60' />
+  </node>
+  <node id='-177894' action='modify' lat='37.55617610315' lon='14.46131920796'>
+    <tag k='sel' v='60' />
+  </node>
+  <node id='-177970' action='modify' lat='37.5564238688' lon='14.4625896564'>
+    <tag k='sel' v='44' />
+  </node>
+  <node id='-177971' action='modify' lat='37.55643489175' lon='14.46270333722' />
+  <node id='-177972' action='modify' lat='37.55639122412' lon='14.46266828401' />
+  <node id='-177973' action='modify' lat='37.5563961531' lon='14.46252422054' />
+  <node id='-178004' action='modify' lat='37.55650397549' lon='14.46266691123'>
+    <tag k='sel' v='45' />
+  </node>
+  <node id='-178005' action='modify' lat='37.55651499843' lon='14.46278059205'>
+    <tag k='sel' v='45' />
+  </node>
+  <node id='-178006' action='modify' lat='37.55647133085' lon='14.46274553885' />
+  <node id='-178007' action='modify' lat='37.55647625982' lon='14.46260147538'>
+    <tag k='sel' v='45' />
+  </node>
+  <node id='1111111' version='1' lat='37.55562761538' lon='14.46126596883'>
+    <tag k='old' v='y' />
+  </node>
+  <node id='1111112' version='1' lat='37.55551838554' lon='14.46120023836'>
+    <tag k='old' v='y' />
+  </node>
+  <way id='-136888' action='modify'>
+    <nd ref='-177366' />
+    <nd ref='-177368' />
+    <nd ref='-177369' />
+    <nd ref='-177370' />
+    <nd ref='-177371' />
+    <nd ref='-177372' />
+    <nd ref='-177373' />
+    <nd ref='-177365' />
+    <nd ref='-177374' />
+    <nd ref='-177375' />
+    <nd ref='-177376' />
+    <nd ref='-177377' />
+    <nd ref='-177378' />
+    <nd ref='-177379' />
+    <nd ref='-177366' />
+    <tag k='sel' v='1' />
+  </way>
+  <way id='-136889' action='modify'>
+    <nd ref='-177381' />
+    <nd ref='-177382' />
+    <nd ref='-177383' />
+    <nd ref='-177384' />
+    <nd ref='-177385' />
+    <nd ref='-177386' />
+    <nd ref='-177387' />
+    <nd ref='-177388' />
+    <nd ref='-177389' />
+    <nd ref='-177390' />
+    <nd ref='-177391' />
+    <nd ref='-177392' />
+    <nd ref='-177393' />
+    <nd ref='-177394' />
+    <nd ref='-177381' />
+    <tag k='sel' v='2' />
+  </way>
+  <way id='-136890' action='modify'>
+    <nd ref='-177396' />
+    <nd ref='-177397' />
+    <nd ref='-177398' />
+    <nd ref='-177399' />
+    <nd ref='-177400' />
+    <nd ref='-177401' />
+    <nd ref='-177402' />
+    <nd ref='-177403' />
+    <nd ref='-177404' />
+    <nd ref='-177405' />
+    <nd ref='-177406' />
+    <nd ref='-177407' />
+    <nd ref='-177408' />
+    <nd ref='-177409' />
+    <nd ref='-177396' />
+    <tag k='sel' v='3' />
+  </way>
+  <way id='-136891' action='modify'>
+    <nd ref='-177410' />
+    <nd ref='-177411' />
+    <nd ref='-177412' />
+    <nd ref='-177413' />
+    <tag k='sel' v='40' />
+  </way>
+  <way id='-136892' action='modify'>
+    <nd ref='-177414' />
+    <nd ref='-177415' />
+    <nd ref='-177416' />
+    <nd ref='-177417' />
+    <tag k='sel' v='41' />
+  </way>
+  <way id='-136893' action='modify'>
+    <nd ref='-177419' />
+    <nd ref='-177456' />
+    <nd ref='-177426' />
+    <nd ref='-177436' />
+  </way>
+  <way id='-136894' action='modify'>
+    <nd ref='-177420' />
+    <nd ref='-177421' />
+    <nd ref='-177422' />
+    <nd ref='-177423' />
+    <nd ref='-177424' />
+    <nd ref='-177425' />
+    <nd ref='-177426' />
+    <tag k='name' v='case1' />
+    <tag k='sel' v='42' />
+  </way>
+  <way id='-136895' action='modify'>
+    <nd ref='-177438' />
+    <nd ref='-177423' />
+    <nd ref='-177452' />
+    <nd ref='-177427' />
+  </way>
+  <way id='-136896' action='modify'>
+    <nd ref='-177429' />
+    <nd ref='-177430' />
+    <nd ref='-177431' />
+    <nd ref='-177432' />
+    <nd ref='-177433' />
+    <nd ref='-177434' />
+    <nd ref='-177435' />
+    <nd ref='-177436' />
+    <nd ref='-177437' />
+    <nd ref='-177438' />
+    <nd ref='-177439' />
+    <nd ref='-177428' />
+    <nd ref='-177440' />
+    <nd ref='-177441' />
+    <nd ref='-177442' />
+    <nd ref='-177443' />
+    <nd ref='-177444' />
+    <nd ref='-177445' />
+    <nd ref='-177446' />
+    <nd ref='-177447' />
+    <nd ref='-177448' />
+    <nd ref='-177449' />
+    <nd ref='-177429' />
+  </way>
+  <way id='-136897' action='modify'>
+    <nd ref='-177428' />
+    <nd ref='-177420' />
+    <nd ref='-177450' />
+    <nd ref='-177418' />
+  </way>
+  <way id='-136898' action='modify'>
+    <nd ref='-177450' />
+    <nd ref='-177451' />
+    <nd ref='-177452' />
+    <nd ref='-177453' />
+    <nd ref='-177454' />
+    <nd ref='-177455' />
+    <tag k='sel' v='43' />
+  </way>
+  <way id='-136899' action='modify'>
+    <nd ref='-177465' />
+    <nd ref='-177475' />
+    <nd ref='-177473' />
+    <nd ref='-177481' />
+    <nd ref='-177460' />
+    <nd ref='-177467' />
+    <tag k='sel' v='12' />
+  </way>
+  <way id='-136900' action='modify'>
+    <nd ref='-177474' />
+    <nd ref='-177457' />
+    <nd ref='-177490' />
+    <nd ref='-177500' />
+    <nd ref='-177485' />
+    <nd ref='-177468' />
+    <tag k='sel' v='11' />
+  </way>
+  <way id='-136901' action='modify'>
+    <nd ref='-177494' />
+    <nd ref='-177466' />
+    <nd ref='-177501' />
+    <nd ref='-177477' />
+    <nd ref='-177486' />
+    <nd ref='-177461' />
+    <tag k='sel' v='13' />
+  </way>
+  <way id='-136902' action='modify'>
+    <nd ref='-177463' />
+    <nd ref='-177482' />
+    <nd ref='-177493' />
+    <nd ref='-177476' />
+    <nd ref='-177459' />
+    <nd ref='-177491' />
+    <nd ref='-177474' />
+    <tag k='sel' v='11' />
+  </way>
+  <way id='-136903' action='modify'>
+    <nd ref='-177471' />
+    <nd ref='-177479' />
+    <nd ref='-177498' />
+    <nd ref='-177462' />
+    <nd ref='-177483' />
+    <nd ref='-177492' />
+    <nd ref='-177465' />
+    <tag k='sel' v='12' />
+  </way>
+  <way id='-136904' action='modify'>
+    <nd ref='-177497' />
+    <nd ref='-177472' />
+    <nd ref='-177480' />
+    <nd ref='-177458' />
+    <nd ref='-177464' />
+    <nd ref='-177484' />
+    <nd ref='-177494' />
+    <tag k='sel' v='13' />
+  </way>
+  <way id='-136905' action='modify'>
+    <nd ref='-177502' />
+    <nd ref='-177503' />
+    <nd ref='-177504' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='25' />
+  </way>
+  <way id='-136906' action='modify'>
+    <nd ref='-177461' />
+    <nd ref='-177470' />
+    <nd ref='-177488' />
+    <nd ref='-177497' />
+    <tag k='sel' v='13' />
+  </way>
+  <way id='-136907' action='modify'>
+    <nd ref='-177468' />
+    <nd ref='-177496' />
+    <nd ref='-177478' />
+    <nd ref='-177463' />
+    <tag k='sel' v='11' />
+  </way>
+  <way id='-136908' action='modify'>
+    <nd ref='-177467' />
+    <nd ref='-177487' />
+    <nd ref='-177495' />
+    <nd ref='-177471' />
+    <tag k='sel' v='12' />
+  </way>
+  <way id='-136909' action='modify'>
+    <nd ref='-177516' />
+    <nd ref='-177514' />
+    <nd ref='-177505' />
+    <nd ref='-177506' />
+    <nd ref='-177508' />
+    <nd ref='-177511' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='21' />
+  </way>
+  <way id='-136910' action='modify'>
+    <nd ref='-177513' />
+    <nd ref='-177509' />
+    <nd ref='-177515' />
+    <nd ref='-177510' />
+    <nd ref='-177512' />
+    <nd ref='-177507' />
+    <nd ref='-177516' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='21' />
+  </way>
+  <way id='-136911' action='modify'>
+    <nd ref='-177517' />
+    <nd ref='-177530' />
+    <nd ref='-177529' />
+    <nd ref='-177528' />
+    <nd ref='-177527' />
+    <nd ref='-177526' />
+    <nd ref='-177525' />
+    <nd ref='-177524' />
+    <nd ref='-177523' />
+    <nd ref='-177522' />
+    <nd ref='-177521' />
+    <nd ref='-177520' />
+    <nd ref='-177519' />
+    <nd ref='-177518' />
+    <nd ref='-177517' />
+    <tag k='sel' v='0' />
+  </way>
+  <way id='-136912' action='modify'>
+    <nd ref='-177531' />
+    <nd ref='-177532' />
+    <nd ref='-177533' />
+    <nd ref='-177534' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='31' />
+  </way>
+  <way id='-136913' action='modify'>
+    <nd ref='-177535' />
+    <nd ref='-177536' />
+    <nd ref='-177537' />
+    <nd ref='-177538' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='32' />
+  </way>
+  <way id='-136914' action='modify'>
+    <nd ref='-177539' />
+    <nd ref='-177543' />
+    <nd ref='-177540' />
+    <nd ref='-177541' />
+    <nd ref='-177543' />
+    <nd ref='-177542' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='33' />
+  </way>
+  <way id='-136915' action='modify'>
+    <nd ref='-177544' />
+    <nd ref='-177545' />
+    <nd ref='-177546' />
+    <nd ref='-177547' />
+    <nd ref='-177545' />
+    <nd ref='-177548' />
+    <nd ref='-177544' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='35' />
+  </way>
+  <way id='-136916' action='modify'>
+    <nd ref='-177549' />
+    <nd ref='-177550' />
+    <nd ref='-177551' />
+    <nd ref='-177552' />
+    <nd ref='-177549' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='34' />
+  </way>
+  <way id='-136917' action='modify'>
+    <nd ref='-177565' />
+    <nd ref='-177564' />
+    <nd ref='-177563' />
+    <nd ref='-177562' />
+    <nd ref='-177561' />
+    <nd ref='-177560' />
+    <nd ref='-177559' />
+    <tag k='sel' v='10' />
+  </way>
+  <way id='-136918' action='modify'>
+    <nd ref='-177556' />
+    <nd ref='-177555' />
+    <nd ref='-177554' />
+    <nd ref='-177553' />
+    <nd ref='-177566' />
+    <nd ref='-177565' />
+    <tag k='sel' v='10' />
+  </way>
+  <way id='-136919' action='modify'>
+    <nd ref='-177559' />
+    <nd ref='-177558' />
+    <nd ref='-177557' />
+    <nd ref='-177556' />
+    <tag k='sel' v='10' />
+  </way>
+  <way id='-136920' action='modify'>
+    <nd ref='-177567' />
+    <nd ref='-177568' />
+    <nd ref='-177569' />
+    <nd ref='-177570' />
+    <nd ref='-177571' />
+    <nd ref='-177572' />
+    <nd ref='-177573' />
+    <nd ref='-177574' />
+    <nd ref='-177575' />
+    <nd ref='-177576' />
+    <nd ref='-177577' />
+    <nd ref='-177578' />
+    <nd ref='-177579' />
+    <nd ref='-177580' />
+    <nd ref='-177567' />
+    <tag k='sel' v='4' />
+  </way>
+  <way id='-136921' action='modify'>
+    <nd ref='-177581' />
+    <nd ref='-177582' />
+    <nd ref='-177583' />
+    <nd ref='-177584' />
+    <nd ref='-177585' />
+    <nd ref='-177586' />
+    <nd ref='-177587' />
+    <tag k='sel' v='14' />
+  </way>
+  <way id='-136922' action='modify'>
+    <nd ref='-177588' />
+    <nd ref='-177589' />
+    <nd ref='-177590' />
+    <nd ref='-177581' />
+    <tag k='sel' v='14' />
+  </way>
+  <way id='-136923' action='modify'>
+    <nd ref='-177587' />
+    <nd ref='-177591' />
+    <nd ref='-177592' />
+    <nd ref='-177593' />
+    <nd ref='-177594' />
+    <nd ref='-177588' />
+    <tag k='sel' v='14' />
+  </way>
+  <way id='-136924' action='modify'>
+    <nd ref='-177596' />
+    <nd ref='-177597' />
+    <nd ref='-177598' />
+    <nd ref='-177599' />
+    <nd ref='-177596' />
+  </way>
+  <way id='-136925' action='modify'>
+    <nd ref='-177603' />
+    <nd ref='-177600' />
+    <nd ref='-177601' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='36' />
+  </way>
+  <way id='-136926' action='modify'>
+    <nd ref='-177608' />
+    <nd ref='-177604' />
+    <nd ref='-177605' />
+    <nd ref='-177606' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='37' />
+  </way>
+  <way id='-136927' action='modify'>
+    <nd ref='-177601' />
+    <nd ref='-177602' />
+    <nd ref='-177603' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='36' />
+  </way>
+  <way id='-136928' action='modify'>
+    <nd ref='-177606' />
+    <nd ref='-177607' />
+    <nd ref='-177605' />
+    <nd ref='-177608' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='37' />
+  </way>
+  <way id='-136929' action='modify'>
+    <nd ref='-177610' />
+    <nd ref='-177611' />
+    <nd ref='-177609' />
+    <nd ref='-177613' />
+    <nd ref='-177612' />
+    <nd ref='-177617' />
+    <nd ref='-177615' />
+    <nd ref='-177621' />
+    <nd ref='-177619' />
+    <nd ref='-177618' />
+    <nd ref='-177616' />
+    <nd ref='-177622' />
+    <nd ref='-177620' />
+    <nd ref='-177614' />
+    <nd ref='-177610' />
+    <tag k='sel' v='5' />
+  </way>
+  <way id='-136930' action='modify'>
+    <nd ref='-177628' />
+    <nd ref='-177626' />
+    <nd ref='-177636' />
+    <nd ref='-177625' />
+    <nd ref='-177627' />
+    <nd ref='-177631' />
+    <nd ref='-177629' />
+    <nd ref='-177632' />
+    <nd ref='-177635' />
+    <nd ref='-177623' />
+    <nd ref='-177633' />
+    <nd ref='-177624' />
+    <nd ref='-177634' />
+    <nd ref='-177630' />
+    <nd ref='-177628' />
+    <tag k='sel' v='15' />
+  </way>
+  <way id='-136931' action='modify'>
+    <nd ref='-177642' />
+    <nd ref='-177640' />
+    <nd ref='-177650' />
+    <nd ref='-177639' />
+    <nd ref='-177641' />
+    <nd ref='-177645' />
+    <nd ref='-177643' />
+    <nd ref='-177646' />
+    <nd ref='-177649' />
+    <nd ref='-177637' />
+    <nd ref='-177647' />
+    <nd ref='-177638' />
+    <nd ref='-177648' />
+    <nd ref='-177644' />
+    <nd ref='-177642' />
+    <tag k='sel' v='7' />
+  </way>
+  <way id='-136932' action='modify'>
+    <nd ref='-177652' />
+    <nd ref='-177662' />
+    <nd ref='-177660' />
+    <nd ref='-177665' />
+    <nd ref='-177654' />
+    <nd ref='-177655' />
+    <nd ref='-177666' />
+    <nd ref='-177653' />
+    <nd ref='-177661' />
+    <nd ref='-177658' />
+    <nd ref='-177659' />
+    <nd ref='-177656' />
+    <nd ref='-177657' />
+    <nd ref='-177663' />
+    <nd ref='-177652' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='28' />
+  </way>
+  <way id='-136933' action='modify'>
+    <nd ref='-177681' />
+    <nd ref='-177668' />
+    <nd ref='-177669' />
+    <nd ref='-177670' />
+    <nd ref='-177671' />
+    <nd ref='-177672' />
+    <nd ref='-177673' />
+    <nd ref='-177674' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='29' />
+  </way>
+  <way id='-136934' action='modify'>
+    <nd ref='-177682' />
+    <nd ref='-177683' />
+    <nd ref='-177684' />
+    <nd ref='-177685' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='29' />
+  </way>
+  <way id='-136935' action='modify'>
+    <nd ref='-177682' />
+    <nd ref='-177685' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='29' />
+  </way>
+  <way id='-136936' action='modify'>
+    <nd ref='-177674' />
+    <nd ref='-177675' />
+    <nd ref='-177676' />
+    <nd ref='-177677' />
+    <nd ref='-177678' />
+    <nd ref='-177679' />
+    <nd ref='-177680' />
+    <nd ref='-177681' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='29' />
+  </way>
+  <way id='-136937' action='modify'>
+    <nd ref='-177686' />
+    <nd ref='-177687' />
+    <nd ref='-177688' />
+    <nd ref='-177689' />
+    <nd ref='-177690' />
+    <nd ref='-177691' />
+    <nd ref='-177692' />
+    <nd ref='-177693' />
+    <nd ref='-177694' />
+    <nd ref='-177695' />
+    <nd ref='-177696' />
+    <nd ref='-177697' />
+    <nd ref='-177698' />
+    <nd ref='-177699' />
+    <nd ref='-177686' />
+    <tag k='sel' v='8' />
+  </way>
+  <way id='-136943' action='modify'>
+    <nd ref='-177757' />
+    <nd ref='-177758' />
+    <nd ref='-177759' />
+    <nd ref='-177760' />
+    <nd ref='-177761' />
+    <nd ref='1111111' />
+    <nd ref='-177762' />
+    <nd ref='-177763' />
+    <nd ref='-177764' />
+    <nd ref='-177765' />
+    <nd ref='-177766' />
+    <nd ref='-177767' />
+    <nd ref='-177768' />
+    <nd ref='-177769' />
+    <nd ref='-177757' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='70' />
+  </way>
+  <way id='-136944' action='modify'>
+    <nd ref='1111112' />
+    <nd ref='-177770' />
+    <nd ref='-177771' />
+    <nd ref='-177772' />
+    <nd ref='-177773' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='sel' v='71' />
+  </way>
+  <way id='-137024' action='modify'>
+    <nd ref='-177971' />
+    <nd ref='-177972' />
+    <nd ref='-177973' />
+    <tag k='sel' v='44' />
+  </way>
+  <way id='-137059' action='modify'>
+    <nd ref='-178005' />
+    <nd ref='-178006' />
+    <nd ref='-178007' />
+    <tag k='sel' v='45' />
+  </way>
+  <relation id='-99764' action='modify'>
+    <member type='way' ref='-136924' role='outer' />
+    <tag k='invalid-selection' v='yes' />
+    <tag k='natural' v='water' />
+    <tag k='sel' v='50' />
+    <tag k='type' v='multipolygon' />
+  </relation>
+</osm>
Index: test/data/regress/20041/circle-action.osm
===================================================================
--- test/data/regress/20041/circle-action.osm	(nonexistent)
+++ test/data/regress/20041/circle-action.osm	(working copy)
@@ -0,0 +1,41 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' generator='JOSM'>
+  <node id='3353142168' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90029704945' lon='8.44321406009' />
+  <node id='3353142170' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90031807489' lon='8.44326193915' />
+  <node id='3353142171' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90030468523' lon='8.44306677855' />
+  <node id='3353142174' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90033729149' lon='8.44301884234' />
+  <node id='3353142175' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90034976283' lon='8.44329321571' />
+  <node id='3353142183' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90040118461' lon='8.44329685665' />
+  <node id='3353142184' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.9004078959' lon='8.44300955386' />
+  <node id='3353142189' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90046511808' lon='8.44319779138' />
+  <node id='3353142190' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90044790476' lon='8.44305434646' />
+  <node id='3353142192' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90046284581' lon='8.44309505092' />
+  <way id='-104527' action='modify' visible='true'>
+    <nd ref='3353142171' />
+    <nd ref='3353142168' />
+    <nd ref='3353142170' />
+    <nd ref='3353142175' />
+    <nd ref='3353142183' />
+    <nd ref='3353142189' />
+    <nd ref='3353142192' />
+    <nd ref='3353142190' />
+    <nd ref='3353142184' />
+    <nd ref='3353142174' />
+    <nd ref='3353142171' />
+    <tag k='barrier' v='fence' />
+  </way>
+  <way id='328483730' timestamp='2015-02-15T23:33:35Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323'>
+    <nd ref='3353142174' />
+    <nd ref='3353142184' />
+    <nd ref='3353142190' />
+    <nd ref='3353142192' />
+    <nd ref='3353142189' />
+    <nd ref='3353142183' />
+    <nd ref='3353142175' />
+    <nd ref='3353142170' />
+    <nd ref='3353142168' />
+    <nd ref='3353142171' />
+    <nd ref='3353142174' />
+    <tag k='natural' v='water' />
+  </way>
+</osm>
Index: test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java
===================================================================
--- test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java	(revision 17386)
+++ test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java	(working copy)
@@ -4,6 +4,7 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -13,9 +14,11 @@
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.actions.AlignInCircleAction.InvalidSelection;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.io.OsmReader;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -149,4 +152,29 @@
         }
     }
 
+    /**
+     * Various cases of selections in file
+     * @throws Exception if an error occurs
+     */
+    @Test
+    void testSelectionEvaluation() throws Exception {
+        DataSet ds = OsmReader.parseDataSet(
+                Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "alignCircleCases.osm")), null);
+
+        for (int i = 0; i < 80; i++) {
+            final String selVal = Integer.toString(i);
+            Set<OsmPrimitive> sel = ds.allPrimitives().stream().filter(p -> p.hasTag("sel", selVal))
+                    .collect(Collectors.toSet());
+            if (sel.isEmpty())
+                continue;
+            ds.setSelected(sel);
+            boolean selValid = sel.stream().noneMatch(p -> p.hasKey("invalid-selection"));
+            try {
+                assertNotNull(AlignInCircleAction.buildCommand(ds), "sel=" + selVal);
+                assertTrue(selValid, "sel=" + selVal + " should be valid ");
+            } catch (InvalidSelection e) {
+                assertTrue(!selValid, "sel=" + selVal + " should be invalid ");
+            }
+        }
+    }
 }
