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 4209)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java	(revision 4209)
@@ -0,0 +1,86 @@
+/*
+ * $Id: BooleanConfigurer.java 705 2005-09-15 13:24:50 +0000 (Thu, 15 Sep 2005) rodneykinney $
+ *
+ * Copyright (c) 2000-2003 by Rodney Kinney
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License (LGPL) as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, copies are available 
+ * at http://www.opensource.org.
+ */
+package org.openstreetmap.josm.plugins.lakewalker;
+
+/**
+ * Configurer for Boolean values
+ */
+public class BooleanConfigurer extends Configurer {
+  private javax.swing.JCheckBox box;
+
+  public BooleanConfigurer() {
+    this(false);
+  }
+  
+  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 ? Boolean.TRUE : Boolean.FALSE);
+  }
+
+  public BooleanConfigurer(String key, String name) {
+    this(key, name, Boolean.FALSE);
+  }
+
+  public String getValueString() {
+    return booleanValue().toString();
+  }
+
+  public void setValue(Object o) {
+    super.setValue(o);
+    if (box != null
+      && !o.equals(new Boolean(box.isSelected()))) {
+      box.setSelected(booleanValue().booleanValue());
+    }
+  }
+
+  public void setValue(String s) {
+    setValue(Boolean.valueOf(s));
+  }
+
+  public void setName(String s) {
+    super.setName(s);
+    if (box != null) {
+      box.setText(s);
+    }
+  }
+
+  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(new Boolean(box.isSelected()));
+        }
+      });
+    }
+    return box;
+  }
+
+  public Boolean booleanValue() {
+    return (Boolean) value;
+  }
+}
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 4208)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java	(revision 4209)
@@ -26,5 +26,5 @@
 public class DoubleConfigurer extends StringConfigurer {
 
-  final static DecimalFormat df = new DecimalFormat("##0.0000000");
+  final static DecimalFormat df = new DecimalFormat("#0.0##########");
   
   public DoubleConfigurer() {
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 4208)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 4209)
@@ -107,5 +107,8 @@
     target += " --threshold=" + Main.pref.get(LakewalkerPreferences.PREF_THRESHOLD, "35");
     target += " --dp-epsilon=" + Main.pref.get(LakewalkerPreferences.PREF_EPSILON, "0.0003");
+    target += " --landsat-res=" + Main.pref.get(LakewalkerPreferences.PREF_LANDSAT_RES, "4000");
+    target += " --tilesize=" + Main.pref.get(LakewalkerPreferences.PREF_LANDSAT_SIZE, "2000");
     target += " --josm";
+    
 
     try {
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java	(revision 4208)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java	(revision 4209)
@@ -5,5 +5,4 @@
 import javax.swing.JLabel;
 import javax.swing.JPanel;
-import javax.swing.JTextField;
 
 import org.openstreetmap.josm.Main;
@@ -19,50 +18,91 @@
   public static final String PREF_THRESHOLD = "lakewalker.threshold";
   public static final String PREF_EPSILON = "lakewalker.epsilon";
+  public static final String PREF_LANDSAT_RES = "lakewalker.landsat_res";
+  public static final String PREF_LANDSAT_SIZE = "lakewalker.landsat_size";
+  public static final String PREF_EAST_OFFSET = "lakewalker.east_offset";
+  public static final String PREF_NORTH_OFFSET = "lakewalker.north_offset";
   
-  protected JTextField python = new JTextField(10);
-  protected IntConfigurer maxSegs = new IntConfigurer();
-  protected IntConfigurer maxNodes = new IntConfigurer();
-  protected IntConfigurer threshold = new IntConfigurer();
-  protected DoubleConfigurer epsilon = new DoubleConfigurer();
+  protected StringConfigurer pythonConfig = new StringConfigurer();
+  protected JLabel pythonLabel = new JLabel(tr("Python executable"));
+  protected IntConfigurer maxSegsConfig = new IntConfigurer();
+  protected JLabel maxSegsLabel = new JLabel(tr("Maximum number of segments per way"));
+  protected IntConfigurer maxNodesConfig = new IntConfigurer();
+  protected JLabel maxNodesLabel = new JLabel(tr("Maximum number of nodes in initial trace"));
+  protected IntConfigurer thresholdConfig = new IntConfigurer();
+  protected JLabel thresholdLabel = new JLabel(tr("Maximum gray value to count as water (0-255)"));
+  protected DoubleConfigurer epsilonConfig = new DoubleConfigurer();
+  protected JLabel epsilonLabel = new JLabel(tr("Line simplification accuracy (degrees)"));
+  protected IntConfigurer landsatResConfig = new IntConfigurer();
+  protected JLabel landsatResLabel = new JLabel(tr("Resolution of Landsat tiles (pixels per degree)"));
+  protected IntConfigurer landsatSizeConfig = new IntConfigurer();
+  protected JLabel landsatSizeLabel = new JLabel(tr("Size of Landsat tiles (pixels)"));
+  protected DoubleConfigurer eastOffsetConfig = new DoubleConfigurer();
+  protected JLabel eastOffsetLabel = new JLabel(tr("Shift all traces to east (degrees)"));
+  protected DoubleConfigurer northOffsetConfig = new DoubleConfigurer();
+  protected JLabel northOffsetLabel = new JLabel(tr("Shift all traces to north (degrees)"));
   
   public void addGui(PreferenceDialog gui) {
-    python.setToolTipText(tr("Path to python executable."));
-    maxSegs.setToolTipText(tr("Maximum nuber of nodes allowed in one way."));
-    maxNodes.setToolTipText(tr("Maximum number of nodes to generate before bailing out (before simplifying lines)."));
-    maxNodes.setToolTipText(tr("Maximum gray value to accept as water (based on Landsat IR-1 data). Can be in the range 0-255."));
-    epsilon.setToolTipText(tr("Accuracy of Douglas-Peucker line simplification, measured in degrees. Lower values give more nodes, and more accurate lines. Defaults to 0.0003."));   
-    
+    pythonConfig.setToolTipText(tr("Path to python executable."));
+    maxSegsConfig.setToolTipText(tr("Maximum number of segments allowed in each generated way. Default 250."));
+    maxNodesConfig.setToolTipText(tr("Maximum number of nodes to generate before bailing out (before simplifying lines). Default 50000."));
+    thresholdConfig.setToolTipText(tr("Maximum gray value to accept as water (based on Landsat IR-1 data). Can be in the range 0-255. Default 35."));
+    epsilonConfig.setToolTipText(tr("Accuracy of Douglas-Peucker line simplification, measured in degrees.<br>Lower values give more nodes, and more accurate lines. Default 0.0003."));
+    landsatResConfig.setToolTipText(tr("Resolution of Landsat tiles, measured in pixels per degree. Default 4000."));
+    landsatSizeConfig.setToolTipText(tr("Size of one landsat tile, measured in pixels. Default 2000."));
+    eastOffsetConfig.setToolTipText(tr("Offset all points in East direction (degrees). Default 0."));   
+    northOffsetConfig.setToolTipText(tr("Offset all points in North direction (degrees). Default 0."));   
+
     String description = tr("An interlude to the Lakewalker Python module to trace water bodies on Landsat imagery.<br><br>Version: {0}", LakewalkerPlugin.VERSION);
-    
     JPanel prefPanel = gui.createPreferenceTab("lakewalker.png", I18n.tr("Lakewalker Plugin Preferences"), description);
     buildPreferences(prefPanel);
     
-    python.setText(Main.pref.get(PREF_PYTHON, "python.exe"));
-    maxSegs.setValue(Main.pref.get(PREF_MAX_SEG, "250"));
-    maxNodes.setValue(Main.pref.get(PREF_MAX_NODES, "50000"));
-    threshold.setValue(Main.pref.get(PREF_THRESHOLD, "35"));
-    epsilon.setValue(Main.pref.get(PREF_EPSILON, "0.0003"));
+    pythonConfig.setValue(Main.pref.get(PREF_PYTHON, "python.exe"));
+    maxSegsConfig.setValue(Main.pref.get(PREF_MAX_SEG, "250"));
+    maxNodesConfig.setValue(Main.pref.get(PREF_MAX_NODES, "50000"));
+    thresholdConfig.setValue(Main.pref.get(PREF_THRESHOLD, "35"));
+    epsilonConfig.setValue(Main.pref.get(PREF_EPSILON, "0.0003"));
+    landsatResConfig.setValue(Main.pref.get(PREF_LANDSAT_RES, "4000"));
+    landsatSizeConfig.setValue(Main.pref.get(PREF_LANDSAT_SIZE, "2000"));
+    eastOffsetConfig.setValue(Main.pref.get(PREF_EAST_OFFSET, "0.0"));
+    northOffsetConfig.setValue(Main.pref.get(PREF_NORTH_OFFSET, "0.0"));
   }
   
   public void buildPreferences(JPanel prefPanel) {
-    prefPanel.add(new JLabel(tr("Python executable")), GBC.std().insets(10,5,5,0));
-    prefPanel.add(python, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
-    prefPanel.add(new JLabel(tr("Maximum number of segments per way")), GBC.std().insets(10,5,5,0));
-    prefPanel.add(maxSegs.getControls(), GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
-    prefPanel.add(new JLabel(tr("Maximum number of nodes to trace")), GBC.std().insets(10,5,5,0));
-    prefPanel.add(maxNodes.getControls(), GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
-    prefPanel.add(new JLabel(tr("Maximum gray value to count as water")), GBC.std().insets(10,5,5,0));
-    prefPanel.add(threshold.getControls(), GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
-    prefPanel.add(new JLabel(tr("Line simplification accuracy, measured in degrees.")), GBC.std().insets(10,5,5,0));
-    prefPanel.add(epsilon.getControls(), GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
-
+    GBC labelConstraints = GBC.std().insets(10,5,5,0);
+    GBC dataConstraints = GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL);
+    
+    prefPanel.add(pythonLabel, labelConstraints);
+    prefPanel.add(pythonConfig.getControls(), dataConstraints);
+    prefPanel.add(maxSegsLabel, labelConstraints);
+    prefPanel.add(maxSegsConfig.getControls(), dataConstraints);
+    prefPanel.add(maxNodesLabel, labelConstraints);
+    prefPanel.add(maxNodesConfig.getControls(), dataConstraints);
+    prefPanel.add(thresholdLabel, labelConstraints);
+    prefPanel.add(thresholdConfig.getControls(), dataConstraints);
+    prefPanel.add(epsilonLabel, labelConstraints);
+    prefPanel.add(epsilonConfig.getControls(), dataConstraints);
+    prefPanel.add(landsatResLabel, labelConstraints);
+    prefPanel.add(landsatResConfig.getControls(), dataConstraints);
+    prefPanel.add(landsatSizeLabel, labelConstraints);
+    prefPanel.add(landsatSizeConfig.getControls(), dataConstraints);    
+    prefPanel.add(eastOffsetLabel, labelConstraints);
+    prefPanel.add(eastOffsetConfig.getControls(), dataConstraints);
+    prefPanel.add(northOffsetLabel, labelConstraints);
+    prefPanel.add(northOffsetConfig.getControls(), dataConstraints);
   }
 
+  /*
+   * Save entered preference values on OK button
+   */
   public void ok() {
-    Main.pref.put(PREF_PYTHON, python.getText());
-    Main.pref.put(PREF_MAX_SEG, maxSegs.getValueString());    
-    Main.pref.put(PREF_MAX_NODES, maxNodes.getValueString());
-    Main.pref.put(PREF_THRESHOLD, threshold.getValueString());
-    Main.pref.put(PREF_EPSILON, epsilon.getValueString());
+    Main.pref.put(PREF_PYTHON, pythonConfig.getValueString());
+    Main.pref.put(PREF_MAX_SEG, maxSegsConfig.getValueString());    
+    Main.pref.put(PREF_MAX_NODES, maxNodesConfig.getValueString());
+    Main.pref.put(PREF_THRESHOLD, thresholdConfig.getValueString());
+    Main.pref.put(PREF_EPSILON, epsilonConfig.getValueString());
+    Main.pref.put(PREF_LANDSAT_RES, landsatResConfig.getValueString());
+    Main.pref.put(PREF_LANDSAT_SIZE, landsatSizeConfig.getValueString());
+    Main.pref.put(PREF_EAST_OFFSET, eastOffsetConfig.getValueString());
+    Main.pref.put(PREF_NORTH_OFFSET, northOffsetConfig.getValueString());
   }
   
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java	(revision 4208)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java	(revision 4209)
@@ -48,6 +48,14 @@
     Node firstNode = null;
     String line;
-    Main.pleaseWaitDlg.currentAction.setText("Initializing");
-    Main.pleaseWaitDlg.repaint();
+    setStatus("Initializing");
+    double eastOffset = 0.0;
+    double northOffset = 0.0;
+    try {
+      eastOffset = Double.parseDouble(Main.pref.get(LakewalkerPreferences.PREF_EAST_OFFSET, "0.0"));
+      northOffset = Double.parseDouble(Main.pref.get(LakewalkerPreferences.PREF_NORTH_OFFSET, "0.0"));
+    }
+    catch (Exception e) {
+      
+    }
 
     try {
@@ -62,5 +70,5 @@
           String[] tokens = line.split(" ");
           try {
-            LatLon ll = new LatLon(Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]));
+            LatLon ll = new LatLon(Double.parseDouble(tokens[1])+northOffset, Double.parseDouble(tokens[2])+eastOffset);
             Node n = new Node(ll);
             commands.add(new AddCommand(n));
@@ -81,6 +89,5 @@
 
         case 's':
-          Main.pleaseWaitDlg.currentAction.setText(line.substring(2));
-          Main.pleaseWaitDlg.repaint();
+          setStatus(line.substring(2));
           break;
           
@@ -113,3 +120,8 @@
   }
   
+  protected void setStatus(String s) {
+    Main.pleaseWaitDlg.currentAction.setText(s);
+    Main.pleaseWaitDlg.repaint();
+  }
+  
 }
