Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java	(revision 23190)
@@ -23,69 +23,69 @@
  */
 public class BooleanConfigurer extends Configurer {
-	private javax.swing.JCheckBox box;
+    private javax.swing.JCheckBox box;
 
-	public BooleanConfigurer() {
-		this(false);
-	}
+    public BooleanConfigurer() {
+        this(false);
+    }
 
-	public BooleanConfigurer(boolean val) {
-		this(null, "", val);
-	}
+    public BooleanConfigurer(boolean val) {
+        this(null, "", val);
+    }
 
-	public BooleanConfigurer(String key, String name, Boolean val) {
-		super(key, name, val);
-	}
+    public BooleanConfigurer(String key, String name, Boolean val) {
+        super(key, name, val);
+    }
 
-	public BooleanConfigurer(String key, String name, boolean val) {
-		super(key, name, val ? Boolean.TRUE : Boolean.FALSE);
-	}
+    public BooleanConfigurer(String key, String name, boolean val) {
+        super(key, name, val ? Boolean.TRUE : Boolean.FALSE);
+    }
 
-	public BooleanConfigurer(String key, String name) {
-		this(key, name, Boolean.FALSE);
-	}
+    public BooleanConfigurer(String key, String name) {
+        this(key, name, Boolean.FALSE);
+    }
 
-	@Override
-	public String getValueString() {
-		return booleanValue().toString();
-	}
+    @Override
+    public String getValueString() {
+        return booleanValue().toString();
+    }
 
-	@Override
-	public void setValue(Object o) {
-		super.setValue(o);
-		if (box != null
-				&& !o.equals(box.isSelected())) {
-			box.setSelected(booleanValue().booleanValue());
-		}
-	}
+    @Override
+    public void setValue(Object o) {
+        super.setValue(o);
+        if (box != null
+                && !o.equals(box.isSelected())) {
+            box.setSelected(booleanValue().booleanValue());
+        }
+    }
 
-	@Override
-	public void setValue(String s) {
-		setValue(Boolean.valueOf(s));
-	}
+    @Override
+    public void setValue(String s) {
+        setValue(Boolean.valueOf(s));
+    }
 
-	@Override
-	public void setName(String s) {
-		super.setName(s);
-		if (box != null) {
-			box.setText(s);
-		}
-	}
+    @Override
+    public void setName(String s) {
+        super.setName(s);
+        if (box != null) {
+            box.setText(s);
+        }
+    }
 
-	@Override
-	public java.awt.Component getControls() {
-		if (box == null) {
-			box = new javax.swing.JCheckBox(getName());
-			box.setSelected(booleanValue().booleanValue());
-			box.addItemListener(new java.awt.event.ItemListener() {
-				public void itemStateChanged(java.awt.event.ItemEvent e) {
-					setValue(box.isSelected());
-				}
-			});
-		}
-		return box;
-	}
+    @Override
+    public java.awt.Component getControls() {
+        if (box == null) {
+            box = new javax.swing.JCheckBox(getName());
+            box.setSelected(booleanValue().booleanValue());
+            box.addItemListener(new java.awt.event.ItemListener() {
+                public void itemStateChanged(java.awt.event.ItemEvent e) {
+                    setValue(box.isSelected());
+                }
+            });
+        }
+        return box;
+    }
 
-	public Boolean booleanValue() {
-		return (Boolean) value;
-	}
+    public Boolean booleanValue() {
+        return (Boolean) value;
+    }
 }
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java	(revision 23190)
@@ -14,5 +14,5 @@
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, copies are available 
+ * License along with this library; if not, copies are available
  * at http://www.opensource.org.
  */
@@ -139,5 +139,5 @@
     changeSupport.addPropertyChangeListener(l);
   }
-  
+
   public void removePropertyChangeListener(PropertyChangeListener l) {
     changeSupport.removePropertyChangeListener(l);
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java	(revision 23190)
@@ -37,5 +37,5 @@
 
     @Override
-	public void setValue(String s) {
+    public void setValue(String s) {
         Double d = null;
         try {
@@ -50,5 +50,5 @@
 
     @Override
-	public void setValue(Object o) {
+    public void setValue(Object o) {
         if (!noUpdate && nameField != null && o != null) {
             nameField.setText(o.toString());
@@ -58,5 +58,5 @@
 
     @Override
-	public String getValueString() {
+    public String getValueString() {
         if (value == null || value.equals("")) {
             return null;
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java	(revision 23190)
@@ -24,53 +24,53 @@
 public class IntConfigurer extends StringConfigurer {
 
-	public IntConfigurer() {
-		super();
-	}
+    public IntConfigurer() {
+        super();
+    }
 
-	public IntConfigurer(String key, String name) {
-		this(key, name, 0);
-	}
+    public IntConfigurer(String key, String name) {
+        this(key, name, 0);
+    }
 
-	public IntConfigurer(String key, String name, Integer val) {
-		super(key, name);
-		if (val != null) {
-			setValue(val);
-		}
-	}
+    public IntConfigurer(String key, String name, Integer val) {
+        super(key, name);
+        if (val != null) {
+            setValue(val);
+        }
+    }
 
-	@Override
-	public void setValue(String s) {
-		Integer i = null;
-		try {
-			i = Integer.valueOf(s);
-		}
-		catch (NumberFormatException e) {
-			i = null;
-		}
-		if (i != null) {
-			setValue(i);
-		}
-	}
+    @Override
+    public void setValue(String s) {
+        Integer i = null;
+        try {
+            i = Integer.valueOf(s);
+        }
+        catch (NumberFormatException e) {
+            i = null;
+        }
+        if (i != null) {
+            setValue(i);
+        }
+    }
 
-	public int getIntValue(int defaultValue) {
-		if (getValue() instanceof Integer) {
-			return ((Integer)getValue()).intValue();
-		}
-		else {
-			return defaultValue;
-		}
-	}
+    public int getIntValue(int defaultValue) {
+        if (getValue() instanceof Integer) {
+            return ((Integer)getValue()).intValue();
+        }
+        else {
+            return defaultValue;
+        }
+    }
 
-	@Override
-	public void setValue(Object o) {
-		if (!noUpdate && nameField != null && o != null) {
-			nameField.setText(o.toString());
-		}
-		super.setValue(o);
-	}
+    @Override
+    public void setValue(Object o) {
+        if (!noUpdate && nameField != null && o != null) {
+            nameField.setText(o.toString());
+        }
+        super.setValue(o);
+    }
 
-	@Override
-	public String getValueString() {
-		return value == null ? null : value.toString();
-	}
+    @Override
+    public String getValueString() {
+        return value == null ? null : value.toString();
+    }
 }
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java	(revision 23190)
@@ -84,128 +84,128 @@
     public ArrayList<double[]> trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat, ProgressMonitor progressMonitor) throws LakewalkerException {
 
-    	progressMonitor.beginTask(null);
-
-    	try {
-
-    		LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer, this.workingdir);
-    		LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon);
-
-    		Boolean detect_loop = false;
-
-    		ArrayList<double[]> nodelist = new ArrayList<double[]>();
-
-    		int[] xy = geo_to_xy(lat,lon,this.resolution);
-
-    		if(!bbox.contains(lat, lon)){
-    			throw new LakewalkerException(tr("The starting location was not within the bbox"));
-    		}
-
-    		int v;
-
-    		progressMonitor.indeterminateSubTask(tr("Looking for shoreline..."));
-
-    		while(true){
-    			double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
-    			if(bbox.contains(geo[0],geo[1])==false){
-    				break;
-    			}
-
-    			v = wms.getPixel(xy[0], xy[1], progressMonitor.createSubTaskMonitor(0, false));
-    			if(v > this.threshold){
-    				break;
-    			}
-
-    			int delta_lat = this.dirslat[getDirectionIndex(this.startdir)];
-    			int delta_lon = this.dirslon[getDirectionIndex(this.startdir)];
-
-    			xy[0] = xy[0]+delta_lon;
-    			xy[1] = xy[1]+delta_lat;
-
-    		}
-
-    		int[] startxy = new int[] {xy[0], xy[1]};
-    		double[] startgeo = xy_to_geo(xy[0],xy[1],this.resolution);
-
-    		//System.out.printf("Found shore at lat %.4f lon %.4f\n",lat,lon);
-
-    		int last_dir = this.getDirectionIndex(this.startdir);
-
-    		for(int i = 0; i < this.maxnode; i++){
-
-    			// Print a counter
-    			if(i % 250 == 0){
-    				progressMonitor.indeterminateSubTask(tr("{0} nodes so far...",i));
-    				//System.out.println(i+" nodes so far...");
-    			}
-
-    			// Some variables we need
-    			int d;
-    			int test_x=0;
-    			int test_y=0;
-    			int new_dir = 0;
-
-    			// Loop through all the directions we can go
-    			for(d = 1; d <= this.dirslat.length; d++){
-
-    				// Decide which direction we want to look at from this pixel
-    				new_dir = (last_dir + d + 4) % 8;
-
-    				test_x = xy[0] + this.dirslon[new_dir];
-    				test_y = xy[1] + this.dirslat[new_dir];
-
-    				double[] geo = xy_to_geo(test_x,test_y,this.resolution);
-
-    				if(!bbox.contains(geo[0], geo[1])){
-    					System.out.println("Outside bbox");
-    					break;
-    				}
-
-    				v = wms.getPixel(test_x, test_y, progressMonitor.createSubTaskMonitor(0, false));
-    				if(v > this.threshold){
-    					break;
-    				}
-
-    				if(d == this.dirslat.length-1){
-    					System.out.println("Got stuck");
-    					break;
-    				}
-    			}
-
-    			// Remember this direction
-    			last_dir = new_dir;
-
-    			// Set the pixel we found as current
-    			xy[0] = test_x;
-    			xy[1] = test_y;
-
-    			// Break the loop if we managed to get back to our starting point
-    			if(xy[0] == startxy[0] && xy[1] == startxy[1]){
-    				break;
-    			}
-
-    			// Store this node
-    			double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
-    			nodelist.add(geo);
-    			//System.out.println("Adding node at "+xy[0]+","+xy[1]+" ("+geo[1]+","+geo[0]+")");
-
-    			// Check if we got stuck in a loop
-    			double start_proximity = Math.pow((geo[0] - startgeo[0]),2) + Math.pow((geo[1] - startgeo[1]),2);
-
-    			if(detect_loop){
-    				if(start_proximity < Math.pow(start_radius_small,2)){
-    					System.out.println("Detected loop");
-    					break;
-    				}
-    			}else{
-    				if(start_proximity > Math.pow(start_radius_big,2)){
-    					detect_loop = true;
-    				}
-    			}
-    		}
-
-    		return nodelist;
-    	} finally {
-    		progressMonitor.finishTask();
-    	}
+        progressMonitor.beginTask(null);
+
+        try {
+
+            LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer, this.workingdir);
+            LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon);
+
+            Boolean detect_loop = false;
+
+            ArrayList<double[]> nodelist = new ArrayList<double[]>();
+
+            int[] xy = geo_to_xy(lat,lon,this.resolution);
+
+            if(!bbox.contains(lat, lon)){
+                throw new LakewalkerException(tr("The starting location was not within the bbox"));
+            }
+
+            int v;
+
+            progressMonitor.indeterminateSubTask(tr("Looking for shoreline..."));
+
+            while(true){
+                double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
+                if(bbox.contains(geo[0],geo[1])==false){
+                    break;
+                }
+
+                v = wms.getPixel(xy[0], xy[1], progressMonitor.createSubTaskMonitor(0, false));
+                if(v > this.threshold){
+                    break;
+                }
+
+                int delta_lat = this.dirslat[getDirectionIndex(this.startdir)];
+                int delta_lon = this.dirslon[getDirectionIndex(this.startdir)];
+
+                xy[0] = xy[0]+delta_lon;
+                xy[1] = xy[1]+delta_lat;
+
+            }
+
+            int[] startxy = new int[] {xy[0], xy[1]};
+            double[] startgeo = xy_to_geo(xy[0],xy[1],this.resolution);
+
+            //System.out.printf("Found shore at lat %.4f lon %.4f\n",lat,lon);
+
+            int last_dir = this.getDirectionIndex(this.startdir);
+
+            for(int i = 0; i < this.maxnode; i++){
+
+                // Print a counter
+                if(i % 250 == 0){
+                    progressMonitor.indeterminateSubTask(tr("{0} nodes so far...",i));
+                    //System.out.println(i+" nodes so far...");
+                }
+
+                // Some variables we need
+                int d;
+                int test_x=0;
+                int test_y=0;
+                int new_dir = 0;
+
+                // Loop through all the directions we can go
+                for(d = 1; d <= this.dirslat.length; d++){
+
+                    // Decide which direction we want to look at from this pixel
+                    new_dir = (last_dir + d + 4) % 8;
+
+                    test_x = xy[0] + this.dirslon[new_dir];
+                    test_y = xy[1] + this.dirslat[new_dir];
+
+                    double[] geo = xy_to_geo(test_x,test_y,this.resolution);
+
+                    if(!bbox.contains(geo[0], geo[1])){
+                        System.out.println("Outside bbox");
+                        break;
+                    }
+
+                    v = wms.getPixel(test_x, test_y, progressMonitor.createSubTaskMonitor(0, false));
+                    if(v > this.threshold){
+                        break;
+                    }
+
+                    if(d == this.dirslat.length-1){
+                        System.out.println("Got stuck");
+                        break;
+                    }
+                }
+
+                // Remember this direction
+                last_dir = new_dir;
+
+                // Set the pixel we found as current
+                xy[0] = test_x;
+                xy[1] = test_y;
+
+                // Break the loop if we managed to get back to our starting point
+                if(xy[0] == startxy[0] && xy[1] == startxy[1]){
+                    break;
+                }
+
+                // Store this node
+                double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
+                nodelist.add(geo);
+                //System.out.println("Adding node at "+xy[0]+","+xy[1]+" ("+geo[1]+","+geo[0]+")");
+
+                // Check if we got stuck in a loop
+                double start_proximity = Math.pow((geo[0] - startgeo[0]),2) + Math.pow((geo[1] - startgeo[1]),2);
+
+                if(detect_loop){
+                    if(start_proximity < Math.pow(start_radius_small,2)){
+                        System.out.println("Detected loop");
+                        break;
+                    }
+                }else{
+                    if(start_proximity > Math.pow(start_radius_big,2)){
+                        detect_loop = true;
+                    }
+                }
+            }
+
+            return nodelist;
+        } finally {
+            progressMonitor.finishTask();
+        }
     }
 
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 23190)
@@ -155,7 +155,7 @@
                 }
 
-				@Override protected void cancel() {
-					LakewalkerAction.this.cancel();
-				}
+                @Override protected void cancel() {
+                    LakewalkerAction.this.cancel();
+                }
             };
             Thread executeThread = new Thread(lakewalkerTask);
@@ -247,5 +247,5 @@
 
                 } catch (Exception ex) {
-                	ex.printStackTrace();
+                    ex.printStackTrace();
                 }
 
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java	(revision 23190)
@@ -5,5 +5,5 @@
 class LakewalkerException extends Exception {
     public LakewalkerException(){
-    	super(tr("An unknown error has occurred"));
+        super(tr("An unknown error has occurred"));
     }
 
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java	(revision 23190)
@@ -15,14 +15,14 @@
  */
 public class LakewalkerPlugin extends Plugin {
-	public LakewalkerPlugin(PluginInformation info) {
-		super(info);
-		MainMenu.add(Main.main.menu.toolsMenu, new LakewalkerAction(tr("Lake Walker")));
-	}
+    public LakewalkerPlugin(PluginInformation info) {
+        super(info);
+        MainMenu.add(Main.main.menu.toolsMenu, new LakewalkerAction(tr("Lake Walker")));
+    }
 
-	@Override
-	public PreferenceSetting getPreferenceSetting()
-	{
-		return new LakewalkerPreferences();
-	}
+    @Override
+    public PreferenceSetting getPreferenceSetting()
+    {
+        return new LakewalkerPreferences();
+    }
 
 }
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java	(revision 23190)
@@ -48,114 +48,114 @@
 
     public BufferedImage getTile(int x, int y, ProgressMonitor progressMonitor) throws LakewalkerException {
-    	progressMonitor.beginTask(tr("Downloading image tile..."));
-    	try {
-    		String layer = "global_mosaic_base";
-
-    		int[] bottom_left_xy = new int[2];
-    		bottom_left_xy[0] = floor(x,this.tilesize);
-    		bottom_left_xy[1] = floor(y,this.tilesize);
-
-    		int[] top_right_xy = new int[2];
-    		top_right_xy[0] = bottom_left_xy[0] + this.tilesize;
-    		top_right_xy[1] = bottom_left_xy[1] + this.tilesize;
-
-    		double[] topright_geo = xy_to_geo(top_right_xy[0],top_right_xy[1],this.resolution);
-    		double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0],bottom_left_xy[1],this.resolution);
-
-    		String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+
-    		"_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png";
-
-    		// The WMS server only understands decimal points using periods, so we need
-    		// to convert to a locale that uses that to build the proper URL
-    		NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
-    		DecimalFormat df = (DecimalFormat)nf;
-    		df.applyLocalizedPattern("0.000000");
-
-    		String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+
-    		"&styles="+wmslayer+"&srs=EPSG:4326&format=image/png"+
-    		"&bbox="+df.format(bottomleft_geo[1])+","+df.format(bottomleft_geo[0])+
-    		","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+
-    		"&width="+this.tilesize+"&height="+this.tilesize;
-
-    		File file = new File(this.working_dir,filename);
-
-    		// Calculate the hashmap key
-    		String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]);
-
-    		// See if this image is already loaded
-    		if(this.image != null){
-    			if(this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]){
-
-    				// Check if this image exists in the hashmap
-    				if(this.imageindex.containsKey(hashkey)){
-    					// Store which image we have
-    					this.imagex = bottom_left_xy[0];
-    					this.imagey = bottom_left_xy[1];
-
-    					// Retrieve from cache
-    					this.image = this.images.get(this.imageindex.get(hashkey));
-    					return this.image;
-    				} else {
-    					this.image = null;
-    				}
-    			} else {
-    				return this.image;
-    			}
-    		}
-
-    		try {
-    			System.out.println("Looking for image in disk cache: "+filename);
-
-    			// Read from a file
-    			this.image = ImageIO.read(file);
-
-    			this.images.add(this.image);
-    			this.imageindex.put(hashkey,this.images.size()-1);
-
-    		} catch(FileNotFoundException e){
-    			System.out.println("Could not find cached image, downloading.");
-    		} catch(IOException e){
-    			System.out.println(e.getMessage());
-    		} catch(Exception e){
-    			System.out.println(e.getMessage());
-    		}
-
-    		if(this.image == null){
-    			/**
-    			 * Try downloading the image
-    			 */
-    			try {
-    				System.out.println("Downloading from "+urlloc);
-
-    				// Read from a URL
-    				URL url = new URL(urlloc);
-    				this.image = ImageIO.read(url); // this can return null!
-    			} catch(MalformedURLException e){
-    				System.out.println(e.getMessage());
-    			} catch(IOException e){
-    				System.out.println(e.getMessage());
-    			} catch(Exception e){
-    				System.out.println(e.getMessage());
-    			}
-
-    			if (this.image != null) {
-    				this.images.add(this.image);
-    				this.imageindex.put(hashkey,this.images.size()-1);
-
-    				this.saveimage(file,this.image);
-    			}
-    		}
-
-    		this.imagex = bottom_left_xy[0];
-    		this.imagey = bottom_left_xy[1];
-
-    		if(this.image == null){
-    			throw new LakewalkerException(tr("Could not acquire image"));
-    		}
-
-    		return this.image;
-    	} finally {
-    		progressMonitor.finishTask();
-    	}
+        progressMonitor.beginTask(tr("Downloading image tile..."));
+        try {
+            String layer = "global_mosaic_base";
+
+            int[] bottom_left_xy = new int[2];
+            bottom_left_xy[0] = floor(x,this.tilesize);
+            bottom_left_xy[1] = floor(y,this.tilesize);
+
+            int[] top_right_xy = new int[2];
+            top_right_xy[0] = bottom_left_xy[0] + this.tilesize;
+            top_right_xy[1] = bottom_left_xy[1] + this.tilesize;
+
+            double[] topright_geo = xy_to_geo(top_right_xy[0],top_right_xy[1],this.resolution);
+            double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0],bottom_left_xy[1],this.resolution);
+
+            String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+
+            "_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png";
+
+            // The WMS server only understands decimal points using periods, so we need
+            // to convert to a locale that uses that to build the proper URL
+            NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
+            DecimalFormat df = (DecimalFormat)nf;
+            df.applyLocalizedPattern("0.000000");
+
+            String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+
+            "&styles="+wmslayer+"&srs=EPSG:4326&format=image/png"+
+            "&bbox="+df.format(bottomleft_geo[1])+","+df.format(bottomleft_geo[0])+
+            ","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+
+            "&width="+this.tilesize+"&height="+this.tilesize;
+
+            File file = new File(this.working_dir,filename);
+
+            // Calculate the hashmap key
+            String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]);
+
+            // See if this image is already loaded
+            if(this.image != null){
+                if(this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]){
+
+                    // Check if this image exists in the hashmap
+                    if(this.imageindex.containsKey(hashkey)){
+                        // Store which image we have
+                        this.imagex = bottom_left_xy[0];
+                        this.imagey = bottom_left_xy[1];
+
+                        // Retrieve from cache
+                        this.image = this.images.get(this.imageindex.get(hashkey));
+                        return this.image;
+                    } else {
+                        this.image = null;
+                    }
+                } else {
+                    return this.image;
+                }
+            }
+
+            try {
+                System.out.println("Looking for image in disk cache: "+filename);
+
+                // Read from a file
+                this.image = ImageIO.read(file);
+
+                this.images.add(this.image);
+                this.imageindex.put(hashkey,this.images.size()-1);
+
+            } catch(FileNotFoundException e){
+                System.out.println("Could not find cached image, downloading.");
+            } catch(IOException e){
+                System.out.println(e.getMessage());
+            } catch(Exception e){
+                System.out.println(e.getMessage());
+            }
+
+            if(this.image == null){
+                /**
+                 * Try downloading the image
+                 */
+                try {
+                    System.out.println("Downloading from "+urlloc);
+
+                    // Read from a URL
+                    URL url = new URL(urlloc);
+                    this.image = ImageIO.read(url); // this can return null!
+                } catch(MalformedURLException e){
+                    System.out.println(e.getMessage());
+                } catch(IOException e){
+                    System.out.println(e.getMessage());
+                } catch(Exception e){
+                    System.out.println(e.getMessage());
+                }
+
+                if (this.image != null) {
+                    this.images.add(this.image);
+                    this.imageindex.put(hashkey,this.images.size()-1);
+
+                    this.saveimage(file,this.image);
+                }
+            }
+
+            this.imagex = bottom_left_xy[0];
+            this.imagey = bottom_left_xy[1];
+
+            if(this.image == null){
+                throw new LakewalkerException(tr("Could not acquire image"));
+            }
+
+            return this.image;
+        } finally {
+            progressMonitor.finishTask();
+        }
     }
 
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java	(revision 23190)
@@ -73,5 +73,5 @@
       nameField.addKeyListener(new java.awt.event.KeyAdapter() {
         @Override
-		public void keyReleased(java.awt.event.KeyEvent evt) {
+        public void keyReleased(java.awt.event.KeyEvent evt) {
           noUpdate = true;
           setValue(nameField.getText());
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java	(revision 19624)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java	(revision 23190)
@@ -64,5 +64,5 @@
     }
     @Override
-	public Component getControls() {
+    public Component getControls() {
         if (panel == null) {
             panel = Box.createHorizontalBox();
@@ -85,5 +85,5 @@
 
     @Override
-	public void setValue(Object o) {
+    public void setValue(Object o) {
         if(o == null)
             o = 0;
@@ -94,5 +94,5 @@
 
     @Override
-	public void setValue(String s) {
+    public void setValue(String s) {
         Integer n = 0;
         for (int i = 0; i < transValues.length; ++i)
@@ -107,5 +107,5 @@
 
     @Override
-	public String getValueString() {
+    public String getValueString() {
         return validValues[(Integer)value];
     }
