Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java	(revision 31124)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java	(revision 31125)
@@ -11,29 +11,57 @@
 public class OsmMercator {
 
-    public static int TILE_SIZE = 256;
+    /**
+     * default tile size
+     */
+    public static int DEFAUL_TILE_SIZE = 256;
+    /** maximum latitude (north) for mercator display */
     public static final double MAX_LAT = 85.05112877980659;
+    /** minimum latitude (south) for mercator display */
     public static final double MIN_LAT = -85.05112877980659;
-    private static double EARTH_RADIUS = 6378137; // equatorial earth radius for EPSG:3857 (Mercator)
-
-    public static double radius(int aZoomlevel) {
-        return (TILE_SIZE * (1 << aZoomlevel)) / (2.0 * Math.PI);
+    /** equatorial earth radius for EPSG:3857 (Mercator) */
+    private static double EARTH_RADIUS = 6378137;
+
+    /**
+     * instance with tile size of 256 for easy conversions
+     */
+    public static final OsmMercator MERCATOR_256 = new OsmMercator();
+
+    /** tile size of the displayed tiles */
+    private int tileSize = DEFAUL_TILE_SIZE;
+
+    /**
+     * Creates instance with default tile size of 256
+     */
+    public OsmMercator() {
+    }
+
+    /**
+     * Creates instance with provided tile size.
+     * @param tileSize
+     */
+    public OsmMercator(int tileSize) {
+        this.tileSize = tileSize;
+    }
+
+    public double radius(int aZoomlevel) {
+        return (tileSize * (1 << aZoomlevel)) / (2.0 * Math.PI);
     }
 
     /**
      * Returns the absolut number of pixels in y or x, defined as: 2^Zoomlevel *
-     * TILE_WIDTH where TILE_WIDTH is the width of a tile in pixels
+     * tileSize where tileSize is the width of a tile in pixels
      *
      * @param aZoomlevel zoom level to request pixel data
      * @return number of pixels
      */
-    public static int getMaxPixels(int aZoomlevel) {
-        return TILE_SIZE * (1 << aZoomlevel);
-    }
-
-    public static int falseEasting(int aZoomlevel) {
+    public int getMaxPixels(int aZoomlevel) {
+        return tileSize * (1 << aZoomlevel);
+    }
+
+    public int falseEasting(int aZoomlevel) {
         return getMaxPixels(aZoomlevel) / 2;
     }
 
-    public static int falseNorthing(int aZoomlevel) {
+    public int falseNorthing(int aZoomlevel) {
         return (-1 * getMaxPixels(aZoomlevel) / 2);
     }
@@ -51,5 +79,5 @@
      * @author Jason Huntley
      */
-    public static double getDistance(int x1, int y1, int x2, int y2, int zoomLevel) {
+    public double getDistance(int x1, int y1, int x2, int y2, int zoomLevel) {
         double la1 = YToLat(y1, zoomLevel);
         double lo1 = XToLon(x1, zoomLevel);
@@ -70,5 +98,5 @@
      * @author Jason Huntley
      */
-    public static double getDistance(double la1, double lo1, double la2, double lo2) {
+    public double getDistance(double la1, double lo1, double la2, double lo2) {
         double aStartLat = Math.toRadians(la1);
         double aStartLong = Math.toRadians(lo1);
@@ -101,5 +129,5 @@
      * @author Jan Peter Stotz
      */
-    public static double LonToX(double aLongitude, int aZoomlevel) {
+    public double LonToX(double aLongitude, int aZoomlevel) {
         int mp = getMaxPixels(aZoomlevel);
         double x = (mp * (aLongitude + 180l)) / 360l;
@@ -125,5 +153,5 @@
      * @author Jan Peter Stotz
      */
-    public static double LatToY(double aLat, int aZoomlevel) {
+    public double LatToY(double aLat, int aZoomlevel) {
         if (aLat < MIN_LAT)
             aLat = MIN_LAT;
@@ -155,5 +183,5 @@
      * @author Jan Peter Stotz
      */
-    public static double XToLon(int aX, int aZoomlevel) {
+    public double XToLon(int aX, int aZoomlevel) {
         return ((360d * aX) / getMaxPixels(aZoomlevel)) - 180.0;
     }
@@ -166,5 +194,5 @@
      * @return [MIN_LAT..MAX_LAT] is about [-85..85]
      */
-    public static double YToLat(int aY, int aZoomlevel) {
+    public double YToLat(int aY, int aZoomlevel) {
         aY += falseNorthing(aZoomlevel);
         double latitude = (Math.PI / 2) - (2 * Math.atan(Math.exp(-1.0 * aY / radius(aZoomlevel))));
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java	(revision 31124)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java	(revision 31125)
@@ -15,4 +15,6 @@
     protected String id;
     private Map<String, String> noTileHeaders;
+    protected int tileSize;
+    protected OsmMercator osmMercator;
 
     public AbstractTMSTileSource(TileSourceInfo info) {
@@ -24,4 +26,6 @@
         this.id = info.getUrl();
         this.noTileHeaders = info.getNoTileHeaders();
+        this.tileSize = info.getTileSize();
+        osmMercator = new OsmMercator(this.tileSize);
     }
 
@@ -81,50 +85,50 @@
     @Override
     public int getTileSize() {
-        return OsmMercator.TILE_SIZE;
+        return tileSize;
     }
 
     @Override
     public double getDistance(double lat1, double lon1, double lat2, double lon2) {
-        return OsmMercator.getDistance(lat1, lon1, lat2, lon2);
+        return osmMercator.getDistance(lat1, lon1, lat2, lon2);
     }
 
     @Override
     public int LonToX(double lon, int zoom) {
-        return (int )OsmMercator.LonToX(lon, zoom);
+        return (int )osmMercator.LonToX(lon, zoom);
     }
 
     @Override
     public int LatToY(double lat, int zoom) {
-        return (int )OsmMercator.LatToY(lat, zoom);
+        return (int )osmMercator.LatToY(lat, zoom);
     }
 
     @Override
     public double XToLon(int x, int zoom) {
-        return OsmMercator.XToLon(x, zoom);
+        return osmMercator.XToLon(x, zoom);
     }
 
     @Override
     public double YToLat(int y, int zoom) {
-        return OsmMercator.YToLat(y, zoom);
+        return osmMercator.YToLat(y, zoom);
     }
 
     @Override
     public double latToTileY(double lat, int zoom) {
-        return OsmMercator.LatToY(lat, zoom) / OsmMercator.TILE_SIZE;
+        return osmMercator.LatToY(lat, zoom) / tileSize;
     }
 
     @Override
     public double lonToTileX(double lon, int zoom) {
-        return OsmMercator.LonToX(lon, zoom) / OsmMercator.TILE_SIZE;
+        return osmMercator.LonToX(lon, zoom) / tileSize;
     }
 
     @Override
     public double tileYToLat(int y, int zoom) {
-        return OsmMercator.YToLat(y * OsmMercator.TILE_SIZE, zoom);
+        return osmMercator.YToLat(y * tileSize, zoom);
     }
 
     @Override
     public double tileXToLon(int x, int zoom) {
-        return OsmMercator.XToLon(x * OsmMercator.TILE_SIZE, zoom);
+        return osmMercator.XToLon(x * tileSize, zoom);
     }
 
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java	(revision 31124)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java	(revision 31125)
@@ -94,10 +94,10 @@
     @Override
     public int LatToY(double lat, int zoom) {
-        return (int )(latToTileY(lat, zoom) * OsmMercator.TILE_SIZE);
+        return (int )(latToTileY(lat, zoom) * tileSize);
     }
 
     @Override
     public double YToLat(int y, int zoom) {
-        return tileYToLat((double )y / OsmMercator.TILE_SIZE, zoom);
+        return tileYToLat((double )y / tileSize, zoom);
     }
 
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TileSourceInfo.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TileSourceInfo.java	(revision 31124)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TileSourceInfo.java	(revision 31125)
@@ -3,4 +3,6 @@
 
 import java.util.Map;
+
+import org.openstreetmap.gui.jmapviewer.OsmMercator;
 
 /**
@@ -28,4 +30,6 @@
     protected String cookies;
 
+    /** tile size of the displayed tiles */
+    private int tileSize = OsmMercator.DEFAUL_TILE_SIZE;
 
     /**
@@ -58,5 +62,5 @@
 
     /**
-     *
+     * Request name of the tile source
      * @return name of the tile source
      */
@@ -66,5 +70,5 @@
 
     /**
-     *
+     * Request URL of the tile source
      * @return url of the tile source
      */
@@ -74,5 +78,5 @@
 
     /**
-     *
+     * Request header information for empty tiles for servers delivering such tile types
      * @return map of headers, that when set, means that this is "no tile at this zoom level" situation
      */
@@ -82,5 +86,5 @@
 
     /**
-     *
+     * Request supported minimum zoom level
      * @return minimum zoom level supported by tile source
      */
@@ -90,5 +94,5 @@
 
     /**
-     *
+     * Request supported maximum zoom level
      * @return maximum zoom level supported by tile source
      */
@@ -98,5 +102,5 @@
 
     /**
-     *
+     * Request cookies to be sent together with request
      * @return cookies to be sent along with request to tile source
      */
@@ -105,3 +109,21 @@
     }
 
+    /**
+     * Request tile size of this tile source
+     * @return tile size provided by this tile source
+     */
+    public int getTileSize() {
+        return tileSize;
+    }
+
+    /**
+     * Sets the tile size provided by this tile source
+     * @param tileSize
+     */
+    public void setTileSize(int tileSize) {
+        if (tileSize <= 0) {
+            throw new AssertionError("Invalid tile size: " + tileSize);
+        }
+        this.tileSize = tileSize;
+    }
 }
