Index: /applications/editors/josm/plugins/seachart/src/render/Renderer.java
===================================================================
--- /applications/editors/josm/plugins/seachart/src/render/Renderer.java	(revision 31013)
+++ /applications/editors/josm/plugins/seachart/src/render/Renderer.java	(revision 31014)
@@ -251,8 +251,14 @@
 		while (git.hasComp()) {
 			git.nextComp();
+			boolean first = true;
 			while (git.hasEdge()) {
 				git.nextEdge();
 				point = context.getPoint(git.next());
-				p.moveTo(point.getX(), point.getY());
+				if (first) {
+					p.moveTo(point.getX(), point.getY());
+					first = false;
+				} else {
+					p.lineTo(point.getX(), point.getY());
+				}
 				while (git.hasNode()) {
 					point = context.getPoint(git.next());
Index: /applications/editors/josm/plugins/seachart/src/render/Rules.java
===================================================================
--- /applications/editors/josm/plugins/seachart/src/render/Rules.java	(revision 31013)
+++ /applications/editors/josm/plugins/seachart/src/render/Rules.java	(revision 31014)
@@ -28,6 +28,7 @@
 public class Rules {
 
-	public static final Color Yland = new Color(0xeca818);
-	public static final Color Bwater = new Color(0x2ea8d8);
+	public static final Color Yland = new Color(0xdcb820);
+	public static final Color Bwater = new Color(0x3ea8c8);
+	public static final Color Gdries = new Color(0x50b050);
 	public static final Color Mline = new Color(0xc480ff);
 	public static final Color Msymb = new Color(0xa30075);
@@ -176,4 +177,11 @@
 	public static void rules () {
 		ArrayList<Feature> objects;
+		if ((objects = Renderer.map.features.get(Obj.LNDARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
+		if ((objects = Renderer.map.features.get(Obj.LAKARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
+		if ((objects = Renderer.map.features.get(Obj.RIVBNK)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
+		if ((objects = Renderer.map.features.get(Obj.RIVERS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) waterways(feature);
+		if ((objects = Renderer.map.features.get(Obj.CANALS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) waterways(feature);
+		if ((objects = Renderer.map.features.get(Obj.DOCARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
+		if ((objects = Renderer.map.features.get(Obj.DEPARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
 		if ((objects = Renderer.map.features.get(Obj.COALNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
 		if ((objects = Renderer.map.features.get(Obj.SLCONS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) shoreline(feature);
@@ -199,5 +207,4 @@
 		if ((objects = Renderer.map.features.get(Obj.UWTROC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) obstructions(feature);
 		if ((objects = Renderer.map.features.get(Obj.MARCUL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
-		if ((objects = Renderer.map.features.get(Obj.WTWAXS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) waterways(feature);
 		if ((objects = Renderer.map.features.get(Obj.RECTRC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) transits(feature);
 		if ((objects = Renderer.map.features.get(Obj.NAVLNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) transits(feature);
@@ -255,5 +262,16 @@
 		switch (feature.type) {
 		case COALNE:
-			Renderer.lineVector(feature, new LineStyle(Color.black, 8, Yland));
+			Renderer.lineVector(feature, new LineStyle(Color.black, 10));
+			break;
+		case DEPARE:
+			Double depmax = 0.0;
+			if (((depmax = (Double) getAttVal(feature, feature.type, 0, Att.DRVAL2)) != null) && (depmax <= 0.0)) {
+				Renderer.lineVector(feature, new LineStyle(Gdries));
+			}
+			break;
+		case DOCARE:
+		case LAKARE:
+		case RIVBNK:
+			Renderer.lineVector(feature, new LineStyle(Bwater));
 			break;
 		case DRGARE:
@@ -272,6 +290,9 @@
 			} else {
 				if (Renderer.zoom >= 14)
-					Renderer.lineVector(feature, new LineStyle(null, 0, new Color(0x40ffffff, true)));
-			}
+					Renderer.lineVector(feature, new LineStyle(new Color(0x40ffffff, true)));
+			}
+			break;
+		case LNDARE:
+			Renderer.lineVector(feature, new LineStyle(Yland));
 			break;
 		case MARCUL:
@@ -930,5 +951,5 @@
 		case TSSRON:
 			if (Renderer.zoom <= 15)
-				Renderer.lineVector(feature, new LineStyle(null, 0, null, new Color(0x80c48080, true)));
+				Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true)));
 			else
 				Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null));
@@ -1108,5 +1129,5 @@
 
 	private static void waterways(Feature feature) {
-		
+		Renderer.lineVector(feature, new LineStyle(Bwater, 20));
 	}
 
Index: /applications/editors/josm/plugins/seachart/src/s57/S57att.java
===================================================================
--- /applications/editors/josm/plugins/seachart/src/s57/S57att.java	(revision 31013)
+++ /applications/editors/josm/plugins/seachart/src/s57/S57att.java	(revision 31014)
@@ -10,7 +10,5 @@
 package s57;
 
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
 
 import s57.S57obj.*;
Index: /applications/editors/josm/plugins/seachart/src/s57/S57map.java
===================================================================
--- /applications/editors/josm/plugins/seachart/src/s57/S57map.java	(revision 31013)
+++ /applications/editors/josm/plugins/seachart/src/s57/S57map.java	(revision 31014)
@@ -27,8 +27,8 @@
 		public double maxlon;
 		public MapBounds() {
-			minlat = 90;
-			minlon = 180;
-			maxlat = -90;
-			maxlon = -180;
+			minlat = Math.toRadians(90);
+			minlon = Math.toRadians(180);
+			maxlat = Math.toRadians(-90);
+			maxlon = Math.toRadians(-180);
 		}
 	}
@@ -221,4 +221,15 @@
 		}
 	}
+	
+	class OSMtag {
+		String key;
+		String val;
+		OSMtag(String k, String v) {
+			key = k;
+			val = v;
+		}
+	}
+	
+	ArrayList<OSMtag> osmtags;
 
 	public NodeTab nodes;
@@ -227,6 +238,9 @@
 	public FtrMap features;
 	public FtrTab index;
-
-	public long ref;
+	
+	public MapBounds bounds;
+
+	public long cref;
+	public long xref;
 	private Feature feature;
 	private Edge edge;
@@ -238,5 +252,7 @@
 		features = new FtrMap();	// All features in map, grouped by type
 		index = new FtrTab();			// Feature look-up table
-		ref = 0x0000ffffffff0000L;// Compound reference generator
+		bounds = new MapBounds();
+		cref = 0x0000ffffffff0000L;// Compound reference generator
+		xref = 0x0fff000000000000L;// Extras reference generator
 	}
 
@@ -371,4 +387,5 @@
 		feature.geom.prim = Pflag.POINT;
 		feature.geom.elems.add(new Prim(id));
+		osmtags = new ArrayList<OSMtag>();
 		edge = null;
 	}
@@ -379,4 +396,5 @@
 		feature.geom.prim = Pflag.LINE;
 		feature.geom.elems.add(new Prim(id));
+		osmtags = new ArrayList<OSMtag>();
 		edge = new Edge();
 	}
@@ -398,4 +416,5 @@
 		feature.reln = Rflag.UNKN;
 		feature.geom.prim = Pflag.AREA;
+		osmtags = new ArrayList<OSMtag>();
 		edge = null;
 	}
@@ -457,8 +476,33 @@
 				}
 			}
+		} else {
+			osmtags.add(new OSMtag(key, val));
 		}
 	}
 
 	public void tagsDone(long id) {
+		if (feature.type == Obj.UNKOBJ) {
+			for (OSMtag tag : osmtags) {
+				Obj obj = S57obj.OSMobj(tag.key, tag.val);
+				if (obj != Obj.UNKOBJ) {
+					feature.type = obj;
+					ObjTab objs = feature.objs.get(obj);
+					if (objs == null) {
+						objs = new ObjTab();
+						feature.objs.put(obj, objs);
+					}
+					AttMap atts = objs.get(0);
+					if (atts == null) {
+						atts = new AttMap();
+						objs.put(0, atts);
+					}
+					AttVal<?> attval = S57val.OSMatt(tag.key, tag.val);
+					if (attval.att != Att.UNKATT) {
+						atts.put(attval.att, attval);
+					}
+					break;
+				}
+			}
+		}
 		switch (feature.geom.prim) {
 		case POINT:
@@ -490,6 +534,172 @@
 		}
 	}
+	
+	public void mapDone() {
+		ArrayList<Feature> coasts = new ArrayList<Feature>();
+		ArrayList<Feature> lands = new ArrayList<Feature>();
+		if (features.get(Obj.LNDARE) == null) {
+			features.put(Obj.LNDARE, new ArrayList<Feature>());
+		}
+		for (Feature feature : features.get(Obj.COALNE)) {
+			Feature land = new Feature();
+			land.type = Obj.LNDARE;
+			land.reln = Rflag.MASTER;
+			land.objs.put(Obj.LNDARE, new ObjTab());
+			if (feature.geom.prim == Pflag.AREA) {
+				land.geom = feature.geom;
+				features.get(Obj.LNDARE).add(land);
+			} else if (feature.geom.prim == Pflag.LINE) {
+				land.geom.prim = Pflag.LINE;
+				for (int i = 0; i < feature.geom.elems.size(); i++) {
+					land.geom.elems.add(feature.geom.elems.get(i));
+				}
+				coasts.add(land);
+			}
+		}
+		while (coasts.size() > 0) {
+			Feature land = coasts.remove(0);
+			Edge fedge = edges.get(land.geom.elems.get(0).id);
+			long first = fedge.first;
+			long last = edges.get(land.geom.elems.get(land.geom.elems.size() - 1).id).last;
+			if (coasts.size() > 0) {
+				boolean added = true;
+				while (added) {
+					added = false;
+					for (int i = 0; i < coasts.size(); i++) {
+						Feature coast = coasts.get(i);
+						Edge edge = edges.get(coast.geom.elems.get(0).id);
+						if (edge.first == last) {
+							land.geom.elems.add(coast.geom.elems.get(0));
+							last = edge.last;
+							coasts.remove(i--);
+							added = true;
+						} else if (edge.last == first) {
+							land.geom.elems.add(0, coast.geom.elems.get(0));
+							first = edge.first;
+							coasts.remove(i--);
+							added = true;
+						}
+					}
+				}
+			}
+			lands.add(land);
+		}
+		for (Feature land : lands) {
+			long first = edges.get(land.geom.elems.get(0).id).first;
+			long last = edges.get(land.geom.elems.get(land.geom.elems.size()-1).id).last;
+			Ext fext = outsideBounds(first);
+			Ext lext = outsideBounds(last);
+			Edge nedge = new Edge();
+			nedge.first = last;
+			nedge.last = first;
+			switch (lext) {
+			case NE:
+			case N:
+				if ((fext != Ext.NE) && (fext != Ext.N)) {
+					nedge.nodes.add(1L);
+					if ((fext != Ext.NW) && (fext != Ext.W)) {
+						nedge.nodes.add(2L);
+						if ((fext != Ext.SW) && (fext != Ext.S)) {
+							nedge.nodes.add(3L);
+							if ((fext != Ext.SE) && (fext != Ext.W)) {
+								nedge.nodes.add(4L);
+							}
+						}
+					}
+				}
+				break;
+			case NW:
+			case W:
+				if ((fext != Ext.NW) && (fext != Ext.W)) {
+					nedge.nodes.add(2L);
+					if ((fext != Ext.SW) && (fext != Ext.S)) {
+						nedge.nodes.add(3L);
+						if ((fext != Ext.SE) && (fext != Ext.E)) {
+							nedge.nodes.add(4L);
+							if ((fext != Ext.NE) && (fext != Ext.N)) {
+								nedge.nodes.add(1L);
+							}
+						}
+					}
+				}
+				break;
+			case SW:
+			case S:
+				if ((fext != Ext.SW) && (fext != Ext.S)) {
+					nedge.nodes.add(3L);
+					if ((fext != Ext.SE) && (fext != Ext.E)) {
+						nedge.nodes.add(4L);
+						if ((fext != Ext.NE) && (fext != Ext.N)) {
+							nedge.nodes.add(1L);
+							if ((fext != Ext.NW) && (fext != Ext.W)) {
+								nedge.nodes.add(2L);
+							}
+						}
+					}
+				}
+				break;
+			case SE:
+			case E:
+				if ((fext != Ext.SE) && (fext != Ext.E)) {
+					nedge.nodes.add(4L);
+					if ((fext != Ext.NE) && (fext != Ext.N)) {
+						nedge.nodes.add(1L);
+						if ((fext != Ext.NW) && (fext != Ext.W)) {
+							nedge.nodes.add(2L);
+							if ((fext != Ext.SW) && (fext != Ext.S)) {
+								nedge.nodes.add(3L);
+							}
+						}
+					}
+				}
+				break;
+			default:
+			}
+			edges.put(++xref, nedge);
+			land.geom.elems.add(new Prim(xref));
+			sortGeom(land);
+			features.get(Obj.LNDARE).add(land);
+		}
+	}
 
 	// Utility methods
+	
+	enum Ext {I, N, NW, W, SW, S, SE, E, NE }
+	Ext outsideBounds(long ref) {
+		Snode node = nodes.get(ref);
+		if (node.lat >= bounds.maxlat) {
+			if (node.lon <= bounds.minlon) {
+				return Ext.NW;
+			} else if (node.lon >= bounds.maxlon) {
+				return Ext.NE;
+			}
+			return Ext.N;
+		}
+		if (node.lat <= bounds.minlat) {
+			if (node.lon <= bounds.minlon) {
+				return Ext.SW;
+			} else if (node.lon >= bounds.maxlon) {
+				return Ext.SE;
+			}
+			return Ext.S;
+		}
+		if (node.lon >= bounds.maxlon) {
+			if (node.lat <= bounds.minlat) {
+				return Ext.SE;
+			} else if (node.lat >= bounds.maxlat) {
+				return Ext.NE;
+			}
+			return Ext.E;
+		}
+		if (node.lon <= bounds.minlon) {
+			if (node.lat <= bounds.minlat) {
+				return Ext.SW;
+			} else if (node.lat >= bounds.maxlat) {
+				return Ext.NW;
+			}
+			return Ext.W;
+		}
+		return Ext.I;
+	}
 	
 	public boolean sortGeom(Feature feature) {
@@ -526,5 +736,5 @@
 						sort.inners++;
 					}
-					comp = new Comp(ref++, 1);
+					comp = new Comp(cref++, 1);
 					sort.refs.add(comp);
 				} else {
Index: /applications/editors/josm/plugins/seachart/src/s57/S57obj.java
===================================================================
--- /applications/editors/josm/plugins/seachart/src/s57/S57obj.java	(revision 31013)
+++ /applications/editors/josm/plugins/seachart/src/s57/S57obj.java	(revision 31014)
@@ -10,7 +10,5 @@
 package s57;
 
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
 
 public class S57obj {
@@ -179,4 +177,19 @@
 			return Obj.UNKOBJ;
 	}
+	
+	private static final HashMap<String, Obj> OSMtags = new HashMap<String, Obj>();
+	static {
+		OSMtags.put("natural=coastline", Obj.COALNE); OSMtags.put("natural=water", Obj.LAKARE);
+		OSMtags.put("waterway=riverbank", Obj.RIVBNK); OSMtags.put("waterway=river", Obj.RIVERS); OSMtags.put("waterway=canal", Obj.CANALS); 
+		OSMtags.put("wetland=tidalflat", Obj.DEPARE);
+	}
+	
+	public static Obj OSMobj(String key, String val) {
+		Obj obj = OSMtags.get(key + "=" + val);
+		if (obj != null) {
+			return obj;
+		}
+		return Obj.UNKOBJ;
+	}
 
 }
Index: /applications/editors/josm/plugins/seachart/src/s57/S57val.java
===================================================================
--- /applications/editors/josm/plugins/seachart/src/s57/S57val.java	(revision 31013)
+++ /applications/editors/josm/plugins/seachart/src/s57/S57val.java	(revision 31014)
@@ -10,6 +10,5 @@
 package s57;
 
-import java.util.ArrayList;
-import java.util.EnumMap;
+import java.util.*;
 
 import s57.S57att.*;
@@ -1243,3 +1242,25 @@
 	}
 
+	static class KeyVal {
+		Att key;
+		Object val;
+		KeyVal(Att k, Object v) {
+			key = k;
+			val = v;
+		}
+	}
+	
+	private static final HashMap<String, KeyVal> OSMtags = new HashMap<String, KeyVal>();
+	static {
+		OSMtags.put("wetland=tidalflat", new KeyVal(Att.DRVAL2, (double)0));
+	}
+	
+	public static AttVal OSMatt(String key, String val) {
+		KeyVal att = OSMtags.get(key + "=" + val);
+		if (att != null) {
+			return new AttVal(att.key, Conv.F, att.val);
+		}
+		return new AttVal(Att.UNKATT, Conv.A, null);
+	}
+
 }
Index: /applications/editors/josm/plugins/seachart/src/seachart/SeachartAction.java
===================================================================
--- /applications/editors/josm/plugins/seachart/src/seachart/SeachartAction.java	(revision 31013)
+++ /applications/editors/josm/plugins/seachart/src/seachart/SeachartAction.java	(revision 31014)
@@ -21,4 +21,5 @@
 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
 import org.openstreetmap.josm.gui.layer.*;
+import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
@@ -146,4 +147,30 @@
 		map = new S57map();
 		if (data != null) {
+			double minlat = 90;
+			double maxlat = -90;
+			double minlon = 180;
+			double maxlon = -180;
+			for (Bounds bounds : data.getDataSourceBounds()) {
+				if (bounds.getMinLat() < minlat) {
+					minlat = bounds.getMinLat();
+				}
+				if (bounds.getMaxLat() > maxlat) {
+					maxlat = bounds.getMaxLat();
+				}
+				if (bounds.getMinLon() < minlon) {
+					minlon = bounds.getMinLon();
+				}
+				if (bounds.getMaxLon() > maxlon) {
+					maxlon = bounds.getMaxLon();
+				}
+			}
+			map.addNode(1, maxlat, minlon);
+			map.addNode(2, minlat, minlon);
+			map.addNode(3, minlat, maxlon);
+			map.addNode(4, maxlat, maxlon);
+			map.bounds.minlat = Math.toRadians(minlat);
+			map.bounds.maxlat = Math.toRadians(maxlat);
+			map.bounds.minlon = Math.toRadians(minlon);
+			map.bounds.maxlon = Math.toRadians(maxlon);
 			for (Node node : data.getNodes()) {
 				LatLon coor = node.getCoor();
@@ -181,4 +208,5 @@
 				}
 			}
+			map.mapDone();
 			if (rendering != null) rendering.zoomChanged();
 		}
Index: /applications/editors/josm/plugins/seachart/src/symbols/Symbols.java
===================================================================
--- /applications/editors/josm/plugins/seachart/src/symbols/Symbols.java	(revision 31013)
+++ /applications/editors/josm/plugins/seachart/src/symbols/Symbols.java	(revision 31014)
@@ -95,4 +95,10 @@
 		public Color fill;
 
+		public LineStyle(Color ifill) {
+			line = null;
+			width = 0;
+			dash = null;
+			fill = ifill;
+		}
 		public LineStyle(Color iline, float iwidth) {
 			line = iline;
