Index: trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java	(revision 11256)
+++ trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java	(revision 11257)
@@ -23,4 +23,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.imagery.DefaultLayer;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
@@ -82,8 +83,8 @@
             case WMTS:
                 // specify which layer to use
-                String layerId = new WMTSTileSource(info).userSelectLayer();
+                DefaultLayer layerId = new WMTSTileSource(info).userSelectLayer();
                 if (layerId != null) {
                     ImageryInfo copy = new ImageryInfo(info);
-                    Collection<String> defaultLayers = new ArrayList<>(1);
+                    Collection<DefaultLayer> defaultLayers = new ArrayList<>(1);
                     defaultLayers.add(layerId);
                     copy.setDefaultLayers(defaultLayers);
Index: trunk/src/org/openstreetmap/josm/data/imagery/DefaultLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/DefaultLayer.java	(revision 11257)
+++ trunk/src/org/openstreetmap/josm/data/imagery/DefaultLayer.java	(revision 11257)
@@ -0,0 +1,32 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data.imagery;
+
+/**
+ *
+ * Simple class representing default layer that might be set in imagery information
+ *
+ * This simple class is needed - as for WMS there is different information needed to specify layer than for WMTS
+ *
+ * @author Wiktor Niesiobedzki
+ *
+ */
+public class DefaultLayer {
+
+    protected String layerName;
+
+    /**
+     * Constructor
+     * @param layerName that is the DefaultLayer
+     */
+    public DefaultLayer(String layerName) {
+        this.layerName = layerName;
+    }
+
+    /**
+     * @return layer name of the default layer
+     */
+    public String getLayerName() {
+        return layerName;
+    }
+
+}
Index: trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11256)
+++ trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11257)
@@ -195,5 +195,5 @@
     private boolean isEpsg4326To3857Supported;
     /** which layers should be activated by default on layer addition. **/
-    private Collection<String> defaultLayers = Collections.emptyList();
+    private Collection<DefaultLayer> defaultLayers = Collections.emptyList();
     // when adding a field, also adapt the ImageryInfo(ImageryInfo)
     // and ImageryInfo(ImageryPreferenceEntry) constructor, equals method, and ImageryPreferenceEntry
@@ -1156,5 +1156,5 @@
      * @return Collection of the layer names
      */
-    public Collection<String> getDefaultLayers() {
+    public Collection<DefaultLayer> getDefaultLayers() {
         return defaultLayers;
     }
@@ -1164,5 +1164,10 @@
      * @param layers set the list of default layers
      */
-    public void setDefaultLayers(Collection<String> layers) {
+    public void setDefaultLayers(Collection<DefaultLayer> layers) {
+        if (ImageryType.WMTS.equals(this.imageryType)) {
+            CheckParameterUtil.ensureThat(layers == null ||
+                    layers.isEmpty() ||
+                    layers.iterator().next() instanceof WMTSDefaultLayer, "Incorrect default layer");
+        }
         this.defaultLayers = layers;
     }
Index: trunk/src/org/openstreetmap/josm/data/imagery/WMTSDefaultLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/WMTSDefaultLayer.java	(revision 11257)
+++ trunk/src/org/openstreetmap/josm/data/imagery/WMTSDefaultLayer.java	(revision 11257)
@@ -0,0 +1,15 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data.imagery;
+
+public class WMTSDefaultLayer extends DefaultLayer {
+    String tileMatrixSet;
+
+    public WMTSDefaultLayer(String layerName, String tileMatrixSet) {
+        super(layerName);
+        this.tileMatrixSet = tileMatrixSet;
+    }
+
+    public String getTileMatrixSet() {
+        return tileMatrixSet;
+    }
+}
Index: trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 11256)
+++ trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 11257)
@@ -174,5 +174,8 @@
                             switch (columnIndex) {
                             case 0:
-                                return SelectLayerDialog.this.layers.get(rowIndex).getKey();
+                                return SelectLayerDialog.this.layers.get(rowIndex).getValue()
+                                        .stream()
+                                        .map(x -> x.name)
+                                        .collect(Collectors.joining(", ")); //this should be only one
                             case 1:
                                 return SelectLayerDialog.this.layers.get(rowIndex).getValue()
@@ -184,5 +187,5 @@
                                         .stream()
                                         .map(x -> x.tileMatrixSet.identifier)
-                                        .collect(Collectors.joining(", "));
+                                        .collect(Collectors.joining(", ")); //this should be only one
                             default:
                                 throw new IllegalArgumentException();
@@ -224,15 +227,11 @@
         }
 
-        private static List<Entry<String, List<Layer>>> groupLayersByName(Collection<Layer> layers) {
-            Map<String, List<Layer>> layerByName = layers.stream().collect(Collectors.groupingBy(x -> x.name));
-            return layerByName.entrySet().stream().sorted(Map.Entry.comparingByKey()).collect(Collectors.toList());
-        }
-
-        public String getSelectedLayer() {
+        public DefaultLayer getSelectedLayer() {
             int index = list.getSelectedRow();
             if (index < 0) {
                 return null; //nothing selected
             }
-            return layers.get(index).getKey();
+            Layer selectedLayer = layers.get(index).getValue().iterator().next();
+            return new WMTSDefaultLayer(selectedLayer.name, selectedLayer.tileMatrixSet.identifier);
         }
     }
@@ -247,5 +246,6 @@
     private ScaleList nativeScaleList;
 
-    private final String defaultLayer;
+    private final WMTSDefaultLayer defaultLayer;
+
 
     /**
@@ -261,5 +261,5 @@
         this.baseUrl = GetCapabilitiesParseHelper.normalizeCapabilitiesUrl(handleTemplate(info.getUrl()));
         this.layers = getCapabilities();
-        this.defaultLayer = info.getDefaultLayers().isEmpty() ? null : info.getDefaultLayers().iterator().next();
+        this.defaultLayer = info.getDefaultLayers().isEmpty() ? null : (WMTSDefaultLayer) info.getDefaultLayers().iterator().next();
         if (this.layers.isEmpty())
             throw new IllegalArgumentException(tr("No layers defined by getCapabilities document: {0}", info.getUrl()));
@@ -270,10 +270,12 @@
      * @return Name of selected layer
      */
-    public String userSelectLayer() {
-        Collection<String> layerNames = layers.stream().map(x -> x.name).collect(Collectors.toSet());
+    public DefaultLayer userSelectLayer() {
+        Collection<Entry<String, List<Layer>>> grouppedLayers = groupLayersByName(layers);;
 
         // if there is only one layer name no point in asking
-        if (layerNames.size() == 1)
-            return layerNames.iterator().next();
+        if (grouppedLayers.size() == 1) {
+            Layer selectedLayer = grouppedLayers.iterator().next().getValue().iterator().next();
+            return new WMTSDefaultLayer(selectedLayer.name, selectedLayer.tileMatrixSet.identifier);
+        }
 
         final SelectLayerDialog layerSelection = new SelectLayerDialog(layers);
@@ -294,4 +296,10 @@
         matcher.appendTail(output);
         return output.toString();
+    }
+
+    private static List<Entry<String, List<Layer>>> groupLayersByName(Collection<Layer> layers) {
+        Map<String, List<Layer>> layerByName = layers.stream().collect(
+                Collectors.groupingBy(x -> x.name + '\u001c' + x.tileMatrixSet.identifier));
+        return layerByName.entrySet().stream().sorted(Map.Entry.comparingByKey()).collect(Collectors.toList());
     }
 
@@ -555,7 +563,9 @@
         // getLayers will return only layers matching the name, if the user already choose the layer
         // so we will not ask the user again to chose the layer, if he just changes projection
-        Collection<Layer> candidates = getLayers(currentLayer != null ? currentLayer.name : defaultLayer, proj.toCode());
+        Collection<Layer> candidates = getLayers(
+                currentLayer != null ? new WMTSDefaultLayer(currentLayer.name, currentLayer.tileMatrixSet.identifier) : defaultLayer,
+                proj.toCode());
+
         if (candidates.size() == 1) {
-
             Layer newLayer = candidates.iterator().next();
             if (newLayer != null) {
@@ -580,13 +590,17 @@
     /**
      *
-     * @param name of the layer to match
+     * @param searchLayer which layer do we look for
      * @param projectionCode projection code to match
      * @return Collection of layers matching the name of the layer and projection, or only projection if name is not provided
      */
-    private Collection<Layer> getLayers(String name, String projectionCode) {
+    private Collection<Layer> getLayers(WMTSDefaultLayer searchLayer, String projectionCode) {
         Collection<Layer> ret = new ArrayList<>();
         if (this.layers != null) {
             for (Layer layer: this.layers) {
-                if ((name == null || name.equals(layer.name)) && (projectionCode == null || projectionCode.equals(layer.tileMatrixSet.crs))) {
+                if ((searchLayer == null || (// if it's null, then accept all layers
+                        searchLayer.getLayerName().equals(layer.name) &&
+                        searchLayer.getTileMatrixSet().equals(layer.tileMatrixSet.identifier)))
+                        && (projectionCode == null || // if it's null, then accept any projection
+                        projectionCode.equals(layer.tileMatrixSet.crs))) {
                     ret.add(layer);
                 }
