Index: /applications/editors/josm/plugins/terracer/build.xml
===================================================================
--- /applications/editors/josm/plugins/terracer/build.xml	(revision 24712)
+++ /applications/editors/josm/plugins/terracer/build.xml	(revision 24713)
@@ -32,5 +32,5 @@
 
 
-    <property name="commit.message" value="select a single node to fix the direction of numbering (Merkaartor style)" />
+    <property name="commit.message" value="applied #j5729 (patch by robome) - make terracing with existing address nodes easier" />
     <property name="plugin.main.version" value="3711" />
 
Index: /applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputDialog.java
===================================================================
--- /applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputDialog.java	(revision 24712)
+++ /applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputDialog.java	(revision 24713)
@@ -16,4 +16,6 @@
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.awt.event.ActionEvent;
 import java.util.TreeSet;
@@ -27,4 +29,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
@@ -55,5 +58,7 @@
 
     final private Way street;
+    final private String streetName;
     final private boolean relationExists;
+    final ArrayList<Node> housenumbers;
 
     protected static final String DEFAULT_MESSAGE = tr("Enter housenumbers or amount of segments");
@@ -65,4 +70,6 @@
     private JLabel hiLabel;
     JTextField hi;
+    private JLabel numbersLabel;
+    JTextField numbers;
     private JLabel streetLabel;
     AutoCompletingComboBox streetComboBox;
@@ -80,7 +87,11 @@
      * @param street If street is not null, we assume, the name of the street to be fixed
      * and just show a label. If street is null, we show a ComboBox/InputField.
+     * @param streetName the name of the street, derived from either the
+     *        street line or the house numbers which are guaranteed to have the
+     *        same name attached (may be null)
      * @param relationExists If the buildings can be added to an existing relation or not.
-     */
-    public HouseNumberInputDialog(HouseNumberInputHandler handler, Way street, boolean relationExists) {
+     * @param housenumbers a list of house numbers in this outline (may be empty)
+     */
+    public HouseNumberInputDialog(HouseNumberInputHandler handler, Way street, String streetName, boolean relationExists, ArrayList<Node> housenumbers) {
         super(Main.parent,
                 tr("Terrace a house"),
@@ -90,5 +101,7 @@
         this.inputHandler = handler;
         this.street = street;
+        this.streetName = streetName;
         this.relationExists = relationExists;
+        this.housenumbers = housenumbers;
         handler.dialog = this;
         JPanel content = getInputPanel();
@@ -162,4 +175,7 @@
             hiLabel = new JLabel();
             hiLabel.setText(tr("Highest Number"));
+            numbersLabel = new JLabel();
+            numbersLabel.setText(tr("List of Numbers"));
+            loLabel.setPreferredSize(new Dimension(111, 16));
             final String txt = relationExists ? tr("add to existing associatedStreet relation") : tr("create an associatedStreet relation");
 
@@ -177,16 +193,33 @@
             inputPanel.add(hiLabel, GBC.std().insets(3,3,0,0));
             inputPanel.add(getHi(), GBC.eol().fill(GBC.HORIZONTAL).insets(5,3,0,0));
+            inputPanel.add(numbersLabel, GBC.std().insets(3,3,0,0));
+            inputPanel.add(getNumbers(), GBC.eol().fill(GBC.HORIZONTAL).insets(5,3,0,0));
             inputPanel.add(interpolationLabel, GBC.std().insets(3,3,0,0));
             inputPanel.add(getInterpolation(), GBC.eol().insets(5,3,0,0));
             inputPanel.add(segmentsLabel, GBC.std().insets(3,3,0,0));
             inputPanel.add(getSegments(), GBC.eol().fill(GBC.HORIZONTAL).insets(5,3,0,0));
-            if (street == null) {
+            if (streetName == null) {
                 inputPanel.add(streetLabel, GBC.std().insets(3,3,0,0));
                 inputPanel.add(getStreet(), GBC.eol().insets(5,3,0,0));
             } else {
-                inputPanel.add(new JLabel(tr("Street name: ")+"\""+street.get("name")+"\""), GBC.eol().insets(3,3,0,0));
+                inputPanel.add(new JLabel(tr("Street name: ")+"\""+streetName+"\""), GBC.eol().insets(3,3,0,0));
             }
             inputPanel.add(handleRelationCheckBox, GBC.eol().insets(3,3,0,0));
             inputPanel.add(deleteOutlineCheckBox, GBC.eol().insets(3,3,0,0));
+            
+            if (numbers.isVisible())
+            {
+                loLabel.setVisible(false);
+                lo.setVisible(false);
+                lo.setEnabled(false);
+                hiLabel.setVisible(false);
+                hi.setVisible(false);
+                hi.setEnabled(false);
+                interpolationLabel.setVisible(false);
+                interpolation.setVisible(false);
+                interpolation.setEnabled(false);
+                segments.setText(String.valueOf(housenumbers.size()));
+                segments.setEditable(false);
+            }
         }
         return inputPanel;
@@ -225,4 +258,31 @@
         }
         return hi;
+    }
+    
+    /**
+     * This method initializes numbers
+     *
+     * @return javax.swing.JTextField
+     */
+    private JTextField getNumbers() {
+        if (numbers == null) {
+            numbers = new JTextField();
+            
+            Iterator<Node> it = housenumbers.iterator();
+            StringBuilder s = new StringBuilder(256);
+            if (it.hasNext()) {
+                s.append(it.next().get("addr:housenumber"));
+                while (it.hasNext())
+                    s.append(';').append(it.next().get("addr:housenumber"));
+            }
+            else {
+                numbersLabel.setVisible(false);
+                numbers.setVisible(false);
+            }
+            
+            numbers.setText(s.toString());
+            numbers.setEditable(false);
+        }
+        return numbers;
     }
 
Index: /applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputHandler.java
===================================================================
--- /applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputHandler.java	(revision 24712)
+++ /applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputHandler.java	(revision 24713)
@@ -19,4 +19,5 @@
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
+import java.util.ArrayList;
 
 import javax.swing.JButton;
@@ -25,4 +26,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -40,9 +42,11 @@
  * @author casualwalker
  */
- public class HouseNumberInputHandler extends JosmAction implements ActionListener, FocusListener, ItemListener {
+public class HouseNumberInputHandler extends JosmAction implements ActionListener, FocusListener, ItemListener {
     private TerracerAction terracerAction;
     private Way outline, street;
+    private String streetName;
     private Node init;
     private Relation associatedStreet;
+    private ArrayList<Node> housenumbers;
     public HouseNumberInputDialog dialog;
 
@@ -54,18 +58,26 @@
      * @param init The node that hints at which side to start the numbering
      * @param street the street, the buildings belong to (may be null)
+     * @param streetName the name of the street, derived from either the street line or
+     *            the house numbers which are guaranteed to have the same name
+     *            attached (may be null)
      * @param associatedStreet a relation where we can add the houses (may be null)
+     * @param housenumbers a list of house number nodes in this outline (may be empty)
      * @param title the title
      */
     public HouseNumberInputHandler(final TerracerAction terracerAction,
-            final Way outline, final Node init, final Way street, final Relation associatedStreet,
-            final String title) {
+            final Way outline, final Node init, final Way street, final String streetName,
+            final Relation associatedStreet,
+            final ArrayList<Node> housenumbers, final String title) {
         this.terracerAction = terracerAction;
         this.outline = outline;
         this.init = init;
         this.street = street;
+        this.streetName = streetName;
         this.associatedStreet = associatedStreet;
+        this.housenumbers = housenumbers;
 
         // This dialog is started modal
-        this.dialog = new HouseNumberInputDialog(this, street, associatedStreet != null);
+        this.dialog = new HouseNumberInputDialog(this, street, streetName,
+                associatedStreet != null, housenumbers);
 
         // We're done
@@ -84,5 +96,5 @@
     private static JButton getButton(Container root, String caption) {
         Component children[] = root.getComponents();
-         for (Component child : children) {
+        for (Component child : children) {
             JButton b;
             if (child instanceof JButton) {
@@ -90,8 +102,8 @@
                 if (caption.equals(b.getText())) return b;
             } else if (child instanceof Container) {
-                  b = getButton((Container)child, caption);
-                  if (b != null) return b;
-             }
-         }
+                b = getButton((Container) child, caption);
+                if (b != null) return b;
+            }
+        }
         return null;
     }
@@ -112,5 +124,6 @@
         isOk = isOk && checkSegments(message);
 
-        // Allow non numeric characters for the low number as long as there is no high number of the segmentcount is 1
+        // Allow non numeric characters for the low number as long as there is
+        // no high number of the segmentcount is 1
         if (dialog.hi.getText().length() > 0 | segments() > 1) {
             isOk = isOk
@@ -139,8 +152,10 @@
                 okButton.setEnabled(false);
 
-            // For some reason the messageLabel doesn't want to show up, so a MessageDialog is shown instead. Someone more knowledgeable might fix this.
+            // For some reason the messageLabel doesn't want to show up, so a
+            // MessageDialog is shown instead. Someone more knowledgeable might fix this.
             dialog.messageLabel.setForeground(Color.red);
             dialog.messageLabel.setText(message.toString());
-            //JOptionPane.showMessageDialog(null, message.toString(), tr("Error"), JOptionPane.ERROR_MESSAGE);
+            // JOptionPane.showMessageDialog(null, message.toString(),
+            // tr("Error"), JOptionPane.ERROR_MESSAGE);
 
             return false;
@@ -180,22 +195,24 @@
      */
     private boolean checkSegmentsFromHousenumber(final StringBuffer message) {
-        dialog.segments.setEditable(true);
-
-        if (numberFrom() != null && numberTo() != null) {
-
-            int segments = numberTo().intValue() - numberFrom().intValue();
-
-            if (segments % stepSize() != 0) {
-                appendMessageNewLine(message);
-                message.append(tr("Housenumbers do not match odd/even setting"));
-                return false;
-            }
-
-            int steps = segments / stepSize();
-            steps++; // difference 0 means 1 building, see
-            // TerracerActon.terraceBuilding
-            dialog.segments.setText(String.valueOf(steps));
-            dialog.segments.setEditable(false);
-
+        if (!dialog.numbers.isVisible()) {
+            dialog.segments.setEditable(true);
+
+            if (numberFrom() != null && numberTo() != null) {
+                int segments = numberTo().intValue() - numberFrom().intValue();
+
+                if (segments % stepSize() != 0) {
+                    appendMessageNewLine(message);
+                    message
+                            .append(tr("Housenumbers do not match odd/even setting"));
+                    return false;
+                }
+
+                int steps = segments / stepSize();
+                steps++; // difference 0 means 1 building, see
+                // TerracerActon.terraceBuilding
+                dialog.segments.setText(String.valueOf(steps));
+                dialog.segments.setEditable(false);
+
+            }
         }
         return true;
@@ -261,5 +278,7 @@
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
      * Called when the user selects from a pulldown selection
@@ -269,5 +288,7 @@
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
      */
@@ -289,4 +310,5 @@
                         dialog.hi.getText(),
                         stepSize(),
+                        housenumbers,
                         streetName(),
                         doHandleRelation(),
@@ -357,9 +379,9 @@
      * Gets the street name.
      *
-     * @return the  street name or null, if not set / invalid.
+     * @return the street name or null, if not set / invalid.
      */
     public String streetName() {
-        if (street != null)
-            return null;
+        if (streetName != null)
+            return streetName;
 
         Object selected = dialog.streetComboBox.getSelectedItem();
@@ -387,9 +409,8 @@
             JOptionPane.showMessageDialog(null, "checkbox", "alert", JOptionPane.ERROR_MESSAGE);
             return true;
-        }  else {
+        } else {
             return this.dialog.handleRelationCheckBox.isSelected();
         }
     }
-
 
     /**
@@ -400,5 +421,7 @@
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     *
      * @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
      */
@@ -407,5 +430,7 @@
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     *
      * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
      */
Index: /applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java
===================================================================
--- /applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java	(revision 24712)
+++ /applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java	(revision 24713)
@@ -16,6 +16,13 @@
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.swing.JOptionPane;
@@ -29,4 +36,5 @@
 import org.openstreetmap.josm.command.DeleteCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -76,4 +84,6 @@
         Way outline = null;
         Way street = null;
+        String streetname = null;
+        ArrayList<Node> housenumbers = new ArrayList<Node>();
         Node init = null;
 
@@ -82,4 +92,5 @@
                 super(message);
             }
+
             InvalidUserInputException() {
                 super();
@@ -88,33 +99,68 @@
 
         try {
-            for (OsmPrimitive osm : sel) {
-                if (osm instanceof Node) {
-                    if (init != null)
+            if (sel.size() == 1) {
+                OsmPrimitive prim = sel.iterator().next();
+
+                if (!(prim instanceof Way))
+                    throw new InvalidUserInputException();
+
+                outline = (Way) prim;
+            } else if (sel.size() > 1) {
+                List<Way> ways = OsmPrimitive.getFilteredList(sel, Way.class);
+                Iterator<Way> wit = ways.iterator();
+                while (wit.hasNext()) {
+                    Way way = wit.next();
+                    if (way.hasKey("building")) {
+                        if (outline != null)
+                            // already have a building
+                            throw new InvalidUserInputException();
+                        outline = way;
+                    } else if (way.hasKey("highway")) {
+                        if (street != null)
+                            // already have a street
+                            throw new InvalidUserInputException();
+                        street = way;
+
+                        if ((streetname = street.get("name")) == null)
+                            throw new InvalidUserInputException();
+                    } else
                         throw new InvalidUserInputException();
-                    init = (Node) osm;
-                } else if (osm instanceof Way) {
-                    if (osm.hasKey("highway")) {
-                        if (street != null)
+                }
+
+                if (outline == null)
+                    throw new InvalidUserInputException();
+
+                List<Node> nodes = OsmPrimitive.getFilteredList(sel, Node.class);
+                Iterator<Node> nit = nodes.iterator();
+                // Actually this should test if the selected address nodes lie
+                // within the selected outline. Any ideas how to do this?
+                while (nit.hasNext()) {
+                    Node node = nit.next();
+                    if (node.hasKey("addr:housenumber")) {
+                        String nodesstreetname = node.get("addr:street");
+                        // if a node has a street name if must be equal
+                        // to the one of the other address nodes
+                        if (nodesstreetname != null) {
+                            if (streetname == null)
+                                streetname = nodesstreetname;
+                            else if (!nodesstreetname.equals(streetname))
+                                throw new InvalidUserInputException();
+                        }
+
+                        housenumbers.add(node);
+                    } else {
+                        // A given node might not be an address node but then
+                        // it has to be part of the building to help getting
+                        // the number direction right.
+                        if (!outline.containsNode(node) || init != null)
                             throw new InvalidUserInputException();
-                        street = (Way) osm;
-                        if (!street.hasKey("name"))
-                            throw new InvalidUserInputException();
-                    } else {
-                        if (outline != null)
-                            throw new InvalidUserInputException();
-                        outline = (Way) osm;
+                        init = node;
                     }
                 }
-            }
-            if (outline == null)
-                throw new InvalidUserInputException();
-            
-            if (init != null && !init.getReferrers().contains(outline))
-                throw new InvalidUserInputException();
-
-            if (outline.getNodesCount() < 5)
-                throw new InvalidUserInputException();
-
-            if (!outline.isClosed())
+
+                Collections.sort(housenumbers, new HousenumberNodeComparator());
+            }
+
+            if (outline == null || !outline.isClosed() || outline.getNodesCount() < 5)
                 throw new InvalidUserInputException();
         } catch (InvalidUserInputException ex) {
@@ -128,5 +174,5 @@
         }
 
-        // If we have a street, try to find a associatedStreet relation that could be reused.
+        // If we have a street, try to find an associatedStreet relation that could be reused.
         Relation associatedStreet = null;
         if (street != null) {
@@ -146,7 +192,29 @@
         }
 
-        String title = trn("Change {0} object", "Change {0} objects", sel.size(), sel.size());
-        // show input dialog.
-        new HouseNumberInputHandler(this, outline, init, street, associatedStreet, title);
+        if (housenumbers.size() == 1) {
+            // Special case of one outline and one address node.
+            // Don't open the dialogue, just copy the node keys
+            // to the outline, set building just in case it isn't there
+            // and remove the node.
+            Collection<Command> commands = new LinkedList<Command>();
+            Way newOutline = new Way(outline);
+            for (Entry<String, String> entry : housenumbers.get(0).getKeys()
+                    .entrySet()) {
+                newOutline.put(entry.getKey(), entry.getValue());
+            }
+            newOutline.put("building", "yes");
+            commands.add(new ChangeCommand(outline, newOutline));
+            commands.add(DeleteCommand.delete(Main.main.getEditLayer(),
+                    housenumbers, true, true));
+            Main.main.undoRedo
+                    .add(new SequenceCommand(tr("Terrace"), commands));
+            Main.main.getCurrentDataSet().setSelected(newOutline);
+        } else {
+            String title = trn("Change {0} object", "Change {0} objects", sel
+                    .size(), sel.size());
+            // show input dialog.
+            new HouseNumberInputHandler(this, outline, init, street, streetname,
+                    associatedStreet, housenumbers, title);
+        }
     }
 
@@ -160,4 +228,41 @@
 
     /**
+     * Sorts the house number nodes according their numbers only
+     * 
+     * @param house
+     *            number nodes
+     */
+    class HousenumberNodeComparator implements Comparator<Node> {
+        private final Pattern pat = Pattern.compile("^([0-9]+)");
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+         */
+        @Override
+        public int compare(Node node1, Node node2) {
+            // It's necessary to strip off trailing non-numbers so we can
+            // compare the numbers itself numerically since string comparison
+            // doesn't work for numbers with different number of digits,
+            // e.g. 9 is higher than 11
+            String node1String = node1.get("addr:housenumber");
+            String node2String = node2.get("addr:housenumber");
+            Matcher mat = pat.matcher(node1String);
+            if (mat.find()) {
+                Integer node1Int = Integer.valueOf(mat.group(1));
+                mat = pat.matcher(node2String);
+                if (mat.find()) {
+                    Integer node2Int = Integer.valueOf(mat.group(1));
+
+                    return node1Int.compareTo(node2Int);
+                }
+            }
+
+            return node1String.compareTo(node2String);
+        }
+    }
+
+    /**
      * Terraces a single, closed, quadrilateral way.
      *
@@ -171,9 +276,15 @@
      * @param street The street, the buildings belong to (may be null)
      * @param associatedStreet
-     * @param From
-     * @param To
-     * @param streetName the name of a street (may be null). Used if not null and street is null.
-     * @param handleRelations If the user likes to add a relation or extend an existing relation
-     * @param deleteOutline If the outline way should be deleted, when done
+     * @param segments The number of segments to generate
+     * @param From Starting housenumber
+     * @param To Ending housenumber
+     * @param step The step width to use
+     * @param housenumbers List of housenumbers to use. From and To are ignored
+     *        if this is set.
+     * @param streetName the name of the street, derived from the street line
+     *        or the house numbers (may be null)
+     * @param handleRelations If the user likes to add a relation or extend an
+     *        existing relation
+     * @param deleteOutline If the outline way should be deleted when done
      */
     public void terraceBuilding(Way outline,
@@ -185,23 +296,41 @@
                 String To,
                 int step,
+                ArrayList<Node> housenumbers,
                 String streetName,
                 boolean handleRelations,
                 boolean deleteOutline) {
         final int nb;
-
-        Integer to, from;
-        to = getNumber(To);
-        from = getNumber(From);
-        if (to != null && from != null) {
-            nb = 1 + (to.intValue() - from.intValue()) / step;
-        } else if (segments != null) {
-            nb = segments.intValue();
+        Integer to = null, from = null;
+        if (housenumbers.isEmpty()) {
+            to = getNumber(To);
+            from = getNumber(From);
+            if (to != null && from != null) {
+                nb = 1 + (to.intValue() - from.intValue()) / step;
+            } else if (segments != null) {
+                nb = segments.intValue();
+            } else {
+                // if we get here, there is is a bug in the input validation.
+                throw new TerracerRuntimeException(
+                        "Could not determine segments from parameters, this is a bug. "
+                                + "Parameters were: segments " + segments
+                                + " from " + from + " to " + to + " step "
+                                + step);
+            }
         } else {
-            // if we get here, there is is a bug in the input validation.
-            throw new TerracerRuntimeException(
-                    "Could not determine segments from parameters, this is a bug. "
-                            + "Parameters were: segments " + segments
-                            + " from " + from + " to " + to + " step " + step);
-        }
+            nb = housenumbers.size();
+        }
+
+        // now find which is the longest side connecting the first node
+        Pair<Way, Way> interp = findFrontAndBack(outline);
+
+        boolean swap = false;
+        if (init != null) {
+            if (interp.a.lastNode().equals(init) || interp.b.lastNode().equals(init)) {
+                swap = true;
+            }
+        }
+
+        final double frontLength = wayLength(interp.a);
+        final double backLength = wayLength(interp.b);
 
         // new nodes array to hold all intermediate nodes
@@ -211,21 +340,5 @@
         Collection<Way> ways = new LinkedList<Way>();
 
-        // Should this building be terraced (i.e. is there more then one section?)
         if (nb > 1) {
-            // create intermediate nodes by interpolating.
-
-            // now find which is the longest side connecting the first node
-            Pair<Way, Way> interp = findFrontAndBack(outline);
-
-            boolean swap = false;
-            if (init != null) {
-                if (interp.a.lastNode().equals(init) || interp.b.lastNode().equals(init)) {
-                    swap = true;
-                }
-            }
-
-            final double frontLength = wayLength(interp.a);
-            final double backLength = wayLength(interp.b);
-
             for (int i = 0; i <= nb; ++i) {
                 int i_dir = swap ? nb - i : i;
@@ -249,8 +362,17 @@
 
                 String number = null;
-                if (from != null) {
-                    number = Integer.toString(from + i * step);
-                }
-                terr = addressBuilding(terr, street, streetName, number);
+                Set<Entry<String, String>> additionalKeys = null;
+                if (housenumbers.isEmpty()) {
+                    if (from != null) {
+                        // only, if the user has specified house numbers
+                        number = Integer.toString(from + i * step);
+                    }
+                } else {
+                    number = housenumbers.get(i).get("addr:housenumber");
+                    additionalKeys = housenumbers.get(i).getKeys().entrySet();
+                }
+
+                terr = addressBuilding(terr, street, streetName, number,
+                        additionalKeys);
 
                 ways.add(terr);
@@ -262,7 +384,7 @@
             }
         } else {
-            // Single section, just add the address details
+            // Single building, just add the address details
             Way newOutline;
-            newOutline = addressBuilding(outline, street, streetName, From);
+            newOutline = addressBuilding(outline, street, streetName, From, null);
             ways.add(newOutline);
             this.commands.add(new ChangeCommand(outline, newOutline));
@@ -283,6 +405,5 @@
                 }
                 this.commands.add(new AddCommand(associatedStreet));
-            }
-            else { // relation exists already - add new members
+            } else { // relation exists already - add new members
                 Relation newAssociatedStreet = new Relation(associatedStreet);
                 for (Way w : ways) {
@@ -292,4 +413,12 @@
             }
         }
+
+        // Remove the address node since their tags have been incorporated into
+        // the terraces.
+        // Or should removing them also be an option?
+        if (!housenumbers.isEmpty())
+            commands.add(DeleteCommand.delete(Main.main.getEditLayer(),
+                    housenumbers, true, true));
+
         Main.main.undoRedo.add(new SequenceCommand(tr("Terrace"), commands));
         if (nb > 1) {
@@ -309,11 +438,19 @@
      * @param streetName the name of a street (may be null). Used if not null and street is null.
      * @param number The house number
+     * @param additionalKeys More keys to be copied onto the new outline
      * @return the way with added address details
      */
-    private Way addressBuilding(Way outline, Way street, String streetName, String number) {
+    private Way addressBuilding(Way outline, Way street, String streetName,
+            String number, Set<Entry<String, String>> additionalKeys) {
         Way changedOutline = outline;
         if (number != null) {
             // only, if the user has specified house numbers
             this.commands.add(new ChangePropertyCommand(changedOutline, "addr:housenumber", number));
+        }
+        if (additionalKeys != null) {
+            for (Entry<String, String> entry : additionalKeys) {
+                this.commands.add(new ChangePropertyCommand(changedOutline,
+                        entry.getKey(), entry.getValue()));
+            }
         }
         changedOutline.put("building", "yes");
@@ -343,6 +480,6 @@
             Pair<Node,Node> p = pairs.get(i);
             final double seg_length = p.a.getCoor().greatCircleDistance(p.b.getCoor());
-            if (l <= seg_length ||
-                    i == pairs.size() - 1) {    // be generous on the last segment (numerical roudoff can lead to a small overshoot)
+            if (l <= seg_length || i == pairs.size() - 1) {
+                // be generous on the last segment (numerical roudoff can lead to a small overshoot)
                 return interpolateNode(p.a, p.b, l / seg_length);
             } else {
@@ -442,5 +579,5 @@
      */
     private int positiveModulus(int a, int n) {
-        if (n <=0)
+        if (n <= 0)
             throw new IllegalArgumentException();
         int res = a % n;
