Index: trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java	(revision 11256)
+++ trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java	(revision 11257)
@@ -8,4 +8,6 @@
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
 
 import org.junit.Ignore;
@@ -38,4 +40,6 @@
     private ImageryInfo testDuplicateTags = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12573-wmts-identifier.xml");
     private ImageryInfo testMissingStyleIdentifer = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12573-wmts-missing-style-identifier.xml");
+    private ImageryInfo testMultipleTileMatrixForLayer = getImagery(TestUtils.getTestDataRoot() +
+            "wmts/bug13975-multiple-tile-matrices-for-one-layer-projection.xml");
 
     /**
@@ -263,4 +267,20 @@
     }
 
+    @Test
+    public void testForMultipleTileMatricesForOneLayerProjection() throws Exception {
+        Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
+        ImageryInfo copy = new ImageryInfo(testMultipleTileMatrixForLayer);
+        Collection<DefaultLayer> defaultLayers = new ArrayList<>(1);
+        defaultLayers.add(new WMTSDefaultLayer("Mashhad_BaseMap_1", "default028mm"));
+        copy.setDefaultLayers(defaultLayers);
+        WMTSTileSource testSource = new WMTSTileSource(copy);
+        testSource.initProjection(Main.getProjection());
+        assertEquals(
+                "http://188.253.0.155:6080/arcgis/rest/services/Mashhad_BaseMap_1/MapServer/WMTS/tile/1.0.0/Mashhad_BaseMap_1"
+                        + "/default/default028mm/1/3/2",
+                testSource.getTileUrl(1, 2, 3)
+                );
+    }
+
     private void verifyTile(LatLon expected, WMTSTileSource source, int x, int y, int z) {
         LatLon ll = new LatLon(source.tileXYToLatLon(x, y, z));
@@ -277,5 +297,4 @@
         LatLon result = new LatLon(testSource.tileXYToLatLon(x, y, z));
         LatLon expected = new LatLon(verifier.tileXYToLatLon(x, y, z + zoomOffset));
-        //System.out.println(z + "/" + x + "/" + y + " - result: " + result.toDisplayString() + " osmMercator: " +  expected.toDisplayString());
         assertEquals("Longitude", LatLon.normalizeLon(expected.lon() - result.lon()), 0.0, 1e-04);
         assertEquals("Latitude", expected.lat(), result.lat(), 1e-04);
