Index: /trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java	(revision 8696)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java	(revision 8697)
@@ -110,12 +110,11 @@
 
         for (int zoom = getMinZoom(); zoom <= getMaxZoom(); zoom++) {
+            // use well known scale set "GoogleCompatibile" from OGC WMTS spec to calculate number of tiles per zoom level
+            // this makes the zoom levels "glued" to standard TMS zoom levels
+            degreesPerTile[zoom] = (SCALE_DENOMINATOR_ZOOM_LEVEL_1 / Math.pow(2, zoom - 1)) * crsScale;
             TileXY maxTileIndex = latLonToTileXY(bottomRight.toCoordinate(), zoom);
             tileXMax[zoom] = maxTileIndex.getXIndex();
             tileYMax[zoom] = maxTileIndex.getYIndex();
-            // use well known scale set "GoogleCompatibile" from OGC WMTS spec to calculate number of tiles per zoom level
-            // this makes the zoom levels "glued" to standard TMS zoom levels
-            degreesPerTile[zoom] = (SCALE_DENOMINATOR_ZOOM_LEVEL_1 / Math.pow(2, zoom - 1)) * crsScale;
-        }
-
+        }
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java	(revision 8696)
+++ /trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java	(revision 8697)
@@ -36,5 +36,4 @@
         Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
         TemplatedWMSTileSource source = new TemplatedWMSTileSource(testImageryWMS);
-        verifyMercatorTile(source, 0, 1, 2);
         verifyMercatorTile(source, 0, 0, 1);
         verifyMercatorTile(source, 0, 0, 2);
@@ -126,6 +125,8 @@
         TemplatedTMSTileSource verifier = new TemplatedTMSTileSource(testImageryTMS);
         LatLon result = getTileLatLon(source, x, y, z);
-        LatLon expected = new LatLon(verifier.tileYToLat(y, z - 1), verifier.tileXToLon(x, z - 1)); //
-        assertTrue("result: " + result.toDisplayString() + " osmMercator: " +  expected.toDisplayString(), result.equalsEpsilon(expected));
+        LatLon expected = new LatLon(verifier.tileYToLat(y, z - 1), verifier.tileXToLon(x, z - 1));
+        assertEquals(expected.lat(), result.lat(), 1e-4);
+        assertEquals(expected.lon(), result.lon(), 1e-4);
+        //assertTrue("result: " + result.toDisplayString() + " osmMercator: " +  expected.toDisplayString(), result.equalsEpsilon(expected));
         LatLon tileCenter = new Bounds(result, getTileLatLon(source, x+1, y+1, z)).getCenter();
         TileXY backwardsResult = source.latLonToTileXY(tileCenter.toCoordinate(), z);
@@ -136,5 +137,8 @@
     private void verifyLocation(TemplatedWMSTileSource source, LatLon location) {
         for (int z = source.getMaxZoom(); z > source.getMinZoom() + 1; z--) {
-            verifyLocation(source, location, z);
+            if (source.getTileXMax(z) != source.getTileXMin(z) && source.getTileYMax(z) != source.getTileYMin(z)) {
+                // do the tests only where there is more than one tile
+                verifyLocation(source, location, z);
+            }
         }
     }
