Index: applications/editors/josm/plugins/seachart/jrender/src/jrender/Jrender.java
===================================================================
--- applications/editors/josm/plugins/seachart/jrender/src/jrender/Jrender.java	(revision 31014)
+++ applications/editors/josm/plugins/seachart/jrender/src/jrender/Jrender.java	(revision 31027)
@@ -33,4 +33,5 @@
 import render.ChartContext;
 import render.Renderer;
+import render.Rules;
 import s57.S57map;
 import s57.S57map.Feature;
@@ -154,4 +155,5 @@
 					}
 				} else if (ln.contains("</osm")) {
+					map.mapDone();
 					inOsm = false;
 					break;
@@ -167,5 +169,8 @@
 								type = (token.split("[\"\']")[1]);
 							} else if (token.matches("^role=.+")) {
-								role = (token.split("[\"\']")[1]);
+								String str[] = token.split("[\"\']");
+								if (str.length > 1) {
+									role = (token.split("[\"\']")[1]);
+								}
 							}
 						}
@@ -193,8 +198,16 @@
 				inOsm = true;
 				map = new S57map();
+				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);
 			}
 		}
 		
-		img = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
+/*		img = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
 		Renderer.reRender(img.createGraphics(), 12, 1, map, context);
 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -202,15 +215,18 @@
 		empty = bos.size();
 		tile(zoom, 1, 0, 0);
-
-		for (int z = 12; z <= 18; z++) {
+*/
+//		for (int z = 12; z <= 18; z++) {
+int z = 9;
 			DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();
 			Document document = domImpl.createDocument("http://www.w3.org/2000/svg", "svg", null);
 			SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
-			svgGenerator.setSVGCanvasSize(new Dimension(256, 256));
-			svgGenerator.setClip(0, 0, 256, 256);
-			svgGenerator.translate(-256, -256);
-			Renderer.reRender(svgGenerator, z, 1, map, context);
+			svgGenerator.setBackground(Rules.Bwater);
+			svgGenerator.clearRect(0, 0, 2048, 2048);
+			svgGenerator.setSVGCanvasSize(new Dimension(2048, 2048));
+			svgGenerator.setClip(0, 0, 2048, 2048);
+//			svgGenerator.translate(-2048, -2048);
+			Renderer.reRender(svgGenerator, z, 0.05, map, context);
 			svgGenerator.stream(dstdir + "tst_" + z + ".svg");
-		}
+//		}
 	}
 	
@@ -281,5 +297,5 @@
 		send = new ArrayList<String>();
 		deletes = new HashMap<String, Boolean>();
-		BufferedReader in = new BufferedReader(new FileReader(srcdir + xtile + "-" + ytile + "-" + zoom + ".osm"));
+		BufferedReader in = new BufferedReader(new FileReader(srcdir + zoom + "-" + xtile + "-" + ytile + ".osm"));
 		String ln;
 		while ((ln = in.readLine()) != null) {
Index: applications/editors/josm/plugins/seachart/src/render/Renderer.java
===================================================================
--- applications/editors/josm/plugins/seachart/src/render/Renderer.java	(revision 31014)
+++ applications/editors/josm/plugins/seachart/src/render/Renderer.java	(revision 31027)
@@ -16,6 +16,8 @@
 import java.util.*;
 
+import render.Rules.*;
 import s57.S57val.*;
 import s57.S57map;
+import s57.S57obj.Obj;
 import s57.S57map.*;
 import symbols.Areas;
@@ -45,5 +47,5 @@
 			g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
 			g2.setStroke(new BasicStroke(0, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
-			Rules.rules();
+			Rules.rules(RuleSet.BASE);
 		}
 	}
@@ -267,4 +269,8 @@
 			}
 		}
+		if ((style.fill != null) && (feature.geom.prim == Pflag.AREA)) {
+			g2.setPaint(style.fill);
+			g2.fill(p);
+		}
 		if (style.line != null) {
 			if (style.dash != null) {
@@ -276,12 +282,8 @@
 				g2.setStroke(new BasicStroke((float) (style.width * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1, dash, 0));
 			} else {
-				g2.setStroke(new BasicStroke((float) (style.width * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
+				g2.setStroke(new BasicStroke((float) (style.width * sScale), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
 			}
 			g2.setPaint(style.line);
 			g2.draw(p);
-		}
-		if (style.fill != null) {
-			g2.setPaint(style.fill);
-			g2.fill(p);
 		}
 	}
Index: applications/editors/josm/plugins/seachart/src/render/Rules.java
===================================================================
--- applications/editors/josm/plugins/seachart/src/render/Rules.java	(revision 31014)
+++ applications/editors/josm/plugins/seachart/src/render/Rules.java	(revision 31027)
@@ -27,4 +27,6 @@
 
 public class Rules {
+	
+	public enum RuleSet { ALL, BASE, SEAMARK }
 
 	public static final Color Yland = new Color(0xdcb820);
@@ -65,5 +67,5 @@
 	}
 	
-	static String getName(Feature feature) {
+	static String getName() {
 		AttVal<?> name = feature.atts.get(Att.OBJNAM);
 		if (name == null) {
@@ -87,5 +89,5 @@
 	public static void addName(Feature feature, int z, Font font, Color colour, Delta delta) {
 		if (Renderer.zoom >= z) {
-			String name = getName(feature);
+			String name = getName();
 			if (name != null) {
 				Renderer.labelText(feature, name, font,  colour, delta);
@@ -175,90 +177,111 @@
 	}
 	
-	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);
-		if ((objects = Renderer.map.features.get(Obj.PIPSOL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) pipelines(feature);
-		if ((objects = Renderer.map.features.get(Obj.CBLSUB)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) cables(feature);
-		if ((objects = Renderer.map.features.get(Obj.PIPOHD)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) pipelines(feature);
-		if ((objects = Renderer.map.features.get(Obj.CBLOHD)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) cables(feature);
-		if ((objects = Renderer.map.features.get(Obj.TSEZNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
-		if ((objects = Renderer.map.features.get(Obj.TSSCRS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
-		if ((objects = Renderer.map.features.get(Obj.TSSRON)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
-		if ((objects = Renderer.map.features.get(Obj.TSELNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
-		if ((objects = Renderer.map.features.get(Obj.TSSLPT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
-		if ((objects = Renderer.map.features.get(Obj.TSSBND)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
-		if ((objects = Renderer.map.features.get(Obj.ISTZNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
-		if ((objects = Renderer.map.features.get(Obj.SNDWAV)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
-		if ((objects = Renderer.map.features.get(Obj.OSPARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
-		if ((objects = Renderer.map.features.get(Obj.FAIRWY)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
-		if ((objects = Renderer.map.features.get(Obj.DRGARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
-		if ((objects = Renderer.map.features.get(Obj.RESARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
-		if ((objects = Renderer.map.features.get(Obj.SPLARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
-		if ((objects = Renderer.map.features.get(Obj.SEAARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
-		if ((objects = Renderer.map.features.get(Obj.OBSTRN)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) obstructions(feature);
-		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.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);
-		if ((objects = Renderer.map.features.get(Obj.HRBFAC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
-		if ((objects = Renderer.map.features.get(Obj.ACHARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
-		if ((objects = Renderer.map.features.get(Obj.ACHBRT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
-		if ((objects = Renderer.map.features.get(Obj.BERTHS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
-		if ((objects = Renderer.map.features.get(Obj.LOKBSN)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) locks(feature);
-		if ((objects = Renderer.map.features.get(Obj.LKBSPT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) locks(feature);
-		if ((objects = Renderer.map.features.get(Obj.GATCON)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) locks(feature);
-		if ((objects = Renderer.map.features.get(Obj.DISMAR)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) distances(feature);
-		if ((objects = Renderer.map.features.get(Obj.HULKES)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) ports(feature);
-		if ((objects = Renderer.map.features.get(Obj.CRANES)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) ports(feature);
-		if ((objects = Renderer.map.features.get(Obj.LNDMRK)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) landmarks(feature);
-		if ((objects = Renderer.map.features.get(Obj.BUISGL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
-		if ((objects = Renderer.map.features.get(Obj.MORFAC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) moorings(feature);
-		if ((objects = Renderer.map.features.get(Obj.NOTMRK)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) notices(feature);
-		if ((objects = Renderer.map.features.get(Obj.SMCFAC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) marinas(feature);
-		if ((objects = Renderer.map.features.get(Obj.BRIDGE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) bridges(feature);
-		if ((objects = Renderer.map.features.get(Obj.PILPNT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) lights(feature);
-		if ((objects = Renderer.map.features.get(Obj.RDOCAL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) callpoint(feature);
-		if ((objects = Renderer.map.features.get(Obj.LITMIN)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) lights(feature);
-		if ((objects = Renderer.map.features.get(Obj.LITMAJ)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) lights(feature);
-		if ((objects = Renderer.map.features.get(Obj.LIGHTS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) lights(feature);
-		if ((objects = Renderer.map.features.get(Obj.SISTAT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
-		if ((objects = Renderer.map.features.get(Obj.SISTAW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
-		if ((objects = Renderer.map.features.get(Obj.CGUSTA)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
-		if ((objects = Renderer.map.features.get(Obj.RDOSTA)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
-		if ((objects = Renderer.map.features.get(Obj.RADSTA)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
-		if ((objects = Renderer.map.features.get(Obj.RTPBCN)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
-		if ((objects = Renderer.map.features.get(Obj.RSCSTA)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
-		if ((objects = Renderer.map.features.get(Obj.PILBOP)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
-		if ((objects = Renderer.map.features.get(Obj.WTWGAG)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) gauges(feature);
-		if ((objects = Renderer.map.features.get(Obj.OFSPLF)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) platforms(feature);
-		if ((objects = Renderer.map.features.get(Obj.WRECKS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) wrecks(feature);
-		if ((objects = Renderer.map.features.get(Obj.LITVES)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) floats(feature);
-		if ((objects = Renderer.map.features.get(Obj.LITFLT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) floats(feature);
-		if ((objects = Renderer.map.features.get(Obj.BOYINB)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) floats(feature);
-		if ((objects = Renderer.map.features.get(Obj.BOYLAT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
-		if ((objects = Renderer.map.features.get(Obj.BOYCAR)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
-		if ((objects = Renderer.map.features.get(Obj.BOYISD)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
-		if ((objects = Renderer.map.features.get(Obj.BOYSAW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
-		if ((objects = Renderer.map.features.get(Obj.BOYSPP)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
-		if ((objects = Renderer.map.features.get(Obj.BOYWTW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
-		if ((objects = Renderer.map.features.get(Obj.BCNLAT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
-		if ((objects = Renderer.map.features.get(Obj.BCNCAR)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
-		if ((objects = Renderer.map.features.get(Obj.BCNISD)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
-		if ((objects = Renderer.map.features.get(Obj.BCNSAW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
-		if ((objects = Renderer.map.features.get(Obj.BCNSPP)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
-		if ((objects = Renderer.map.features.get(Obj.BCNWTW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
-	}
-	
-	private static void areas(Feature feature) {
-		String name = getName(feature);
+	static Feature feature;
+	static ArrayList<Feature> objects;
+	static RuleSet ruleset;	
+	static boolean testObject(Obj obj) {
+		return ((objects = Renderer.map.features.get(obj)) != null);
+	}
+	
+	static boolean testFeature(Feature f) {
+		return ((feature = f).reln == Rflag.MASTER);
+	}
+	
+	public static void rules (RuleSet set) {
+		ruleset = set;
+		if ((set == RuleSet.ALL) || (set == RuleSet.BASE)) {
+			if (testObject(Obj.LNDARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.BUAARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.HRBFAC)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.HRBBSN)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.LOKBSN)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.LKBSPT)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.LAKARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.RIVBNK)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.RIVERS)) for (Feature f : objects) if (testFeature(f)) waterways();
+			if (testObject(Obj.CANALS)) for (Feature f : objects) if (testFeature(f)) waterways();
+			if (testObject(Obj.DEPARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.COALNE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.ROADWY)) for (Feature f : objects) if (testFeature(f)) highways();
+			if (testObject(Obj.RAILWY)) for (Feature f : objects) if (testFeature(f)) highways();
+		}
+		if (testObject(Obj.SLCONS)) for (Feature f : objects) if (testFeature(f)) shoreline();
+		if ((set == RuleSet.ALL) || (set == RuleSet.SEAMARK)) {
+			if (testObject(Obj.PIPSOL)) for (Feature f : objects) if (testFeature(f)) pipelines();
+			if (testObject(Obj.CBLSUB)) for (Feature f : objects) if (testFeature(f)) cables();
+			if (testObject(Obj.PIPOHD)) for (Feature f : objects) if (testFeature(f)) pipelines();
+			if (testObject(Obj.CBLOHD)) for (Feature f : objects) if (testFeature(f)) cables();
+			if (testObject(Obj.TSEZNE)) for (Feature f : objects) if (testFeature(f)) separation();
+			if (testObject(Obj.TSSCRS)) for (Feature f : objects) if (testFeature(f)) separation();
+			if (testObject(Obj.TSSRON)) for (Feature f : objects) if (testFeature(f)) separation();
+			if (testObject(Obj.TSELNE)) for (Feature f : objects) if (testFeature(f)) separation();
+			if (testObject(Obj.TSSLPT)) for (Feature f : objects) if (testFeature(f)) separation();
+			if (testObject(Obj.TSSBND)) for (Feature f : objects) if (testFeature(f)) separation();
+			if (testObject(Obj.ISTZNE)) for (Feature f : objects) if (testFeature(f)) separation();
+			if (testObject(Obj.SNDWAV)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.OSPARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.FAIRWY)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.DRGARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.RESARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.SPLARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.SEAARE)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.OBSTRN)) for (Feature f : objects) if (testFeature(f)) obstructions();
+			if (testObject(Obj.UWTROC)) for (Feature f : objects) if (testFeature(f)) obstructions();
+			if (testObject(Obj.MARCUL)) for (Feature f : objects) if (testFeature(f)) areas();
+			if (testObject(Obj.RECTRC)) for (Feature f : objects) if (testFeature(f)) transits();
+			if (testObject(Obj.NAVLNE)) for (Feature f : objects) if (testFeature(f)) transits();
+			if (testObject(Obj.HRBFAC)) for (Feature f : objects) if (testFeature(f)) harbours();
+			if (testObject(Obj.ACHARE)) for (Feature f : objects) if (testFeature(f)) harbours();
+			if (testObject(Obj.ACHBRT)) for (Feature f : objects) if (testFeature(f)) harbours();
+			if (testObject(Obj.BERTHS)) for (Feature f : objects) if (testFeature(f)) harbours();
+			if (testObject(Obj.DISMAR)) for (Feature f : objects) if (testFeature(f)) distances();
+			if (testObject(Obj.HULKES)) for (Feature f : objects) if (testFeature(f)) ports();
+			if (testObject(Obj.CRANES)) for (Feature f : objects) if (testFeature(f)) ports();
+			if (testObject(Obj.LNDMRK)) for (Feature f : objects) if (testFeature(f)) landmarks();
+			if (testObject(Obj.BUISGL)) for (Feature f : objects) if (testFeature(f)) harbours();
+			if (testObject(Obj.MORFAC)) for (Feature f : objects) if (testFeature(f)) moorings();
+			if (testObject(Obj.NOTMRK)) for (Feature f : objects) if (testFeature(f)) notices();
+			if (testObject(Obj.SMCFAC)) for (Feature f : objects) if (testFeature(f)) marinas();
+			if (testObject(Obj.BRIDGE)) for (Feature f : objects) if (testFeature(f)) bridges();
+			if (testObject(Obj.PILPNT)) for (Feature f : objects) if (testFeature(f)) lights();
+			if (testObject(Obj.RDOCAL)) for (Feature f : objects) if (testFeature(f)) callpoint();
+			if (testObject(Obj.LITMIN)) for (Feature f : objects) if (testFeature(f)) lights();
+			if (testObject(Obj.LITMAJ)) for (Feature f : objects) if (testFeature(f)) lights();
+			if (testObject(Obj.LIGHTS)) for (Feature f : objects) if (testFeature(f)) lights();
+			if (testObject(Obj.SISTAT)) for (Feature f : objects) if (testFeature(f)) stations();
+			if (testObject(Obj.SISTAW)) for (Feature f : objects) if (testFeature(f)) stations();
+			if (testObject(Obj.CGUSTA)) for (Feature f : objects) if (testFeature(f)) stations();
+			if (testObject(Obj.RDOSTA)) for (Feature f : objects) if (testFeature(f)) stations();
+			if (testObject(Obj.RADSTA)) for (Feature f : objects) if (testFeature(f)) stations();
+			if (testObject(Obj.RTPBCN)) for (Feature f : objects) if (testFeature(f)) stations();
+			if (testObject(Obj.RSCSTA)) for (Feature f : objects) if (testFeature(f)) stations();
+			if (testObject(Obj.PILBOP)) for (Feature f : objects) if (testFeature(f)) stations();
+			if (testObject(Obj.WTWGAG)) for (Feature f : objects) if (testFeature(f)) gauges();
+			if (testObject(Obj.OFSPLF)) for (Feature f : objects) if (testFeature(f)) platforms();
+			if (testObject(Obj.WRECKS)) for (Feature f : objects) if (testFeature(f)) wrecks();
+			if (testObject(Obj.LITVES)) for (Feature f : objects) if (testFeature(f)) floats();
+			if (testObject(Obj.LITFLT)) for (Feature f : objects) if (testFeature(f)) floats();
+			if (testObject(Obj.BOYINB)) for (Feature f : objects) if (testFeature(f)) floats();
+			if (testObject(Obj.BOYLAT)) for (Feature f : objects) if (testFeature(f)) buoys();
+			if (testObject(Obj.BOYCAR)) for (Feature f : objects) if (testFeature(f)) buoys();
+			if (testObject(Obj.BOYISD)) for (Feature f : objects) if (testFeature(f)) buoys();
+			if (testObject(Obj.BOYSAW)) for (Feature f : objects) if (testFeature(f)) buoys();
+			if (testObject(Obj.BOYSPP)) for (Feature f : objects) if (testFeature(f)) buoys();
+			if (testObject(Obj.BOYWTW)) for (Feature f : objects) if (testFeature(f)) buoys();
+			if (testObject(Obj.BCNLAT)) for (Feature f : objects) if (testFeature(f)) beacons();
+			if (testObject(Obj.BCNCAR)) for (Feature f : objects) if (testFeature(f)) beacons();
+			if (testObject(Obj.BCNISD)) for (Feature f : objects) if (testFeature(f)) beacons();
+			if (testObject(Obj.BCNSAW)) for (Feature f : objects) if (testFeature(f)) beacons();
+			if (testObject(Obj.BCNSPP)) for (Feature f : objects) if (testFeature(f)) beacons();
+			if (testObject(Obj.BCNWTW)) for (Feature f : objects) if (testFeature(f)) beacons();
+		}
+	}
+	
+	private static void areas() {
+		String name = getName();
 		switch (feature.type) {
+		case BUAARE:
+			Renderer.lineVector(feature, new LineStyle(new Color(0x40000000, true)));
+			break;
 		case COALNE:
 			Renderer.lineVector(feature, new LineStyle(Color.black, 10));
@@ -270,8 +293,7 @@
 			}
 			break;
-		case DOCARE:
 		case LAKARE:
 		case RIVBNK:
-			Renderer.lineVector(feature, new LineStyle(Bwater));
+			Renderer.lineVector(feature, new LineStyle(Bwater, 10, Bwater));
 			break;
 		case DRGARE:
@@ -291,4 +313,14 @@
 				if (Renderer.zoom >= 14)
 					Renderer.lineVector(feature, new LineStyle(new Color(0x40ffffff, true)));
+			}
+			break;
+		case LKBSPT:
+		case LOKBSN:
+		case HRBBSN:
+			Renderer.lineVector(feature, new LineStyle(Color.black, 10, Bwater));
+			break;
+		case HRBFAC:
+			if (feature.objs.get(Obj.HRBBSN) != null) {
+				Renderer.lineVector(feature, new LineStyle(Color.black, 10, Bwater));
 			}
 			break;
@@ -384,5 +416,5 @@
 	}
 	
-	private static void beacons(Feature feature) {
+	private static void beacons() {
 		if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BCNLAT) || (feature.type == Obj.BCNCAR)))) {
 			BcnSHP shape = (BcnSHP)getAttEnum(feature, feature.type, 0, Att.BCNSHP);
@@ -427,5 +459,5 @@
 	}
 	
-	private static void buoys(Feature feature) {
+	private static void buoys() {
 		if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BOYLAT) || (feature.type == Obj.BOYCAR)))) {
 			BoySHP shape = (BoySHP) getAttEnum(feature, feature.type, 0, Att.BOYSHP);
@@ -451,5 +483,5 @@
 	}
 	
-	private static void bridges(Feature feature) {
+	private static void bridges() {
 		if (Renderer.zoom >= 16) {
 			double verclr, verccl, vercop, horclr;
@@ -490,5 +522,5 @@
 	}
 	
-	private static void cables(Feature feature) {
+	private static void cables() {
 		if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
 			if (feature.type == Obj.CBLSUB) {
@@ -512,5 +544,5 @@
 	}
 	
-	private static void callpoint(Feature feature) {
+	private static void callpoint() {
 		if (Renderer.zoom >= 14) {
 			Symbol symb = Harbours.CallPoint2;
@@ -531,5 +563,5 @@
 	}
 	
-	private static void distances(Feature feature) {
+	private static void distances() {
 		if (Renderer.zoom >= 14) {
 			if (!testAttribute(feature, Obj.DISMAR, 0, Att.CATDIS, CatDIS.DIS_NONI)) {
@@ -574,5 +606,5 @@
 	}
 	
-	private static void floats(Feature feature) {
+	private static void floats() {
 		switch (feature.type) {
 		case LITVES:
@@ -593,5 +625,5 @@
 	}
 	
-	private static void gauges(Feature feature) {
+	private static void gauges() {
 		if (Renderer.zoom >= 14) {
 			Renderer.symbol(feature, Harbours.TideGauge);
@@ -600,6 +632,6 @@
 	}
 	
-	private static void harbours(Feature feature) {
-		String name = getName(feature);
+	private static void harbours() {
+		String name = getName();
 		switch (feature.type) {
 		case ACHBRT:
@@ -717,5 +749,35 @@
 	}
 	
-	private static void landmarks(Feature feature) {
+	private static void highways() {
+		switch (feature.type) {
+		case ROADWY:
+			ArrayList<CatROD> cat = (ArrayList<CatROD>) (getAttList(feature, Obj.ROADWY, 0, Att.CATROD));
+			if (cat.size() > 0) {
+				switch (cat.get(0)) {
+				case ROD_MWAY:
+					Renderer.lineVector(feature, new LineStyle(Color.black, 20));
+					break;
+				case ROD_MAJR:
+					Renderer.lineVector(feature, new LineStyle(Color.black, 15));
+					break;
+				case ROD_MINR:
+					Renderer.lineVector(feature, new LineStyle(Color.black, 10));
+					break;
+				default:
+					Renderer.lineVector(feature, new LineStyle(Color.black, 5));
+				}
+			} else {
+				Renderer.lineVector(feature, new LineStyle(Color.black, 5));
+			}
+			break;
+		case RAILWY:
+			Renderer.lineVector(feature, new LineStyle(Color.gray, 10));
+			Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 30, 30 }));
+			break;
+		default:
+		}
+	}
+	
+	private static void landmarks() {
 		ArrayList<CatLMK> cats = (ArrayList<CatLMK>) getAttList(feature, feature.type, 0, Att.CATLMK);
 		Symbol catSym = Landmarks.Shapes.get(cats.get(0));
@@ -734,5 +796,5 @@
 	}
 	
-	private static void lights(Feature feature) {
+	private static void lights() {
 		switch (feature.type) {
 		case LITMAJ:
@@ -764,8 +826,5 @@
 	}
 
-	private static void locks(Feature feature) {
-	}
-
-	private static void marinas(Feature feature) {
+	private static void marinas() {
 		if (Renderer.zoom >= 16) {
 			ArrayList<Symbol> symbols = new ArrayList<Symbol>();
@@ -778,5 +837,5 @@
 	}
 	
-	private static void moorings(Feature feature) {
+	private static void moorings() {
 		switch ((CatMOR) getAttEnum(feature, feature.type, 0, Att.CATMOR)) {
 		case MOR_DLPN:
@@ -804,5 +863,5 @@
 	}
 
-	private static void notices(Feature feature) {
+	private static void notices() {
 		if (Renderer.zoom >= 14) {
 			double dx = 0.0, dy = 0.0;
@@ -871,5 +930,5 @@
 	}
 
-	private static void obstructions(Feature feature) {
+	private static void obstructions() {
 		if ((Renderer.zoom >= 12) && (feature.type == Obj.OBSTRN)) {
 			switch ((CatOBS) getAttEnum(feature, feature.type, 0, Att.CATOBS)) {
@@ -899,5 +958,5 @@
 	}
 
-	private static void pipelines(Feature feature) {
+	private static void pipelines() {
 		if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
 			if (feature.type == Obj.PIPSOL) {
@@ -921,5 +980,5 @@
 	}
 
-	private static void platforms(Feature feature) {
+	private static void platforms() {
 		ArrayList<CatOFP> cats = (ArrayList<CatOFP>) getAttList(feature, Obj.OFSPLF, 0, Att.CATOFP);
 		if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO)
@@ -931,5 +990,5 @@
 	}
 
-	private static void ports(Feature feature) {
+	private static void ports() {
 		if (Renderer.zoom >= 14) {
 			if (feature.type == Obj.CRANES) {
@@ -945,5 +1004,5 @@
 	}
 
-	private static void separation(Feature feature) {
+	private static void separation() {
 		switch (feature.type) {
 		case TSEZNE:
@@ -973,37 +1032,42 @@
 	}
 
-	private static void shoreline(Feature feature) {
-		if (Renderer.zoom >= 12) {
-			switch ((CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC)) {
-			case SLC_TWAL:
-				WatLEV lev = (WatLEV) getAttEnum(feature, feature.type, 0, Att.WATLEV);
-				if (lev == WatLEV.LEV_CVRS) {
-					Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
+	private static void shoreline() {
+		if ((ruleset == RuleSet.ALL) || (ruleset == RuleSet.BASE)) {
+			Renderer.lineVector(feature, new LineStyle(Color.black, 10, Yland));
+		}
+		if ((ruleset == RuleSet.ALL) || (ruleset == RuleSet.SEAMARK)) {
+			if (Renderer.zoom >= 12) {
+				switch ((CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC)) {
+				case SLC_TWAL:
+					WatLEV lev = (WatLEV) getAttEnum(feature, feature.type, 0, Att.WATLEV);
+					if (lev == WatLEV.LEV_CVRS) {
+						Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
+						if (Renderer.zoom >= 15)
+							Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 80);
+					} else {
+						Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null));
+					}
 					if (Renderer.zoom >= 15)
-						Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 80);
-				} else {
-					Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null));
-				}
-				if (Renderer.zoom >= 15)
-					Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -30);
-				break;
-			case SLC_SWAY:
-				Renderer.lineVector(feature, new LineStyle(Color.black, 2, null, new Color(0xffe000)));
-				if ((Renderer.zoom >= 16) && feature.objs.containsKey(Obj.SMCFAC)) {
-					ArrayList<Symbol> symbols = new ArrayList<Symbol>();
-					ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(feature, Obj.SMCFAC, 0, Att.CATSCF);
-					for (CatSCF scf : scfs) {
-						symbols.add(Facilities.Cats.get(scf));
-					}
-					Renderer.cluster(feature, symbols);
-				}
-				break;
-			default:
-				break;
-			}
-		}
-	}
-
-	private static void stations(Feature feature) {
+						Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -30);
+					break;
+				case SLC_SWAY:
+					Renderer.lineVector(feature, new LineStyle(Color.black, 2, null, new Color(0xffe000)));
+					if ((Renderer.zoom >= 16) && feature.objs.containsKey(Obj.SMCFAC)) {
+						ArrayList<Symbol> symbols = new ArrayList<Symbol>();
+						ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(feature, Obj.SMCFAC, 0, Att.CATSCF);
+						for (CatSCF scf : scfs) {
+							symbols.add(Facilities.Cats.get(scf));
+						}
+						Renderer.cluster(feature, symbols);
+					}
+					break;
+				default:
+					break;
+				}
+			}
+		}
+	}
+
+	private static void stations() {
 		if (Renderer.zoom >= 14) {
 			String str = "";
@@ -1109,5 +1173,5 @@
 	}
 
-	private static void transits(Feature feature) {
+	private static void transits() {
 	  if (Renderer.zoom >= 14) {
 	  	if (feature.type == Obj.RECTRC) Renderer.lineVector (feature, new LineStyle(Color.black, 10, null, null));
@@ -1116,5 +1180,5 @@
 		if (Renderer.zoom >= 15) {
 			String str = "";
-			String name = getName(feature);
+			String name = getName();
 			if (name != null)
 				str += name + " ";
@@ -1128,9 +1192,9 @@
 	}
 
-	private static void waterways(Feature feature) {
+	private static void waterways() {
 		Renderer.lineVector(feature, new LineStyle(Bwater, 20));
 	}
 
-	private static void wrecks(Feature feature) {
+	private static void wrecks() {
 		if (Renderer.zoom >= 14) {
 			switch ((CatWRK) getAttEnum(feature, feature.type, 0, Att.CATWRK)) {
Index: applications/editors/josm/plugins/seachart/src/s57/S57map.java
===================================================================
--- applications/editors/josm/plugins/seachart/src/s57/S57map.java	(revision 31014)
+++ applications/editors/josm/plugins/seachart/src/s57/S57map.java	(revision 31027)
@@ -18,4 +18,6 @@
 import s57.S57val;
 import s57.S57val.*;
+import s57.S57osm;
+import s57.S57osm.*;
 
 public class S57map {
@@ -482,25 +484,24 @@
 
 	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;
-				}
+		for (OSMtag tag : osmtags) {
+			KeyVal kv = S57osm.OSMtag(tag.key, tag.val);
+			if (kv.obj != Obj.UNKOBJ) {
+				if (feature.type == Obj.UNKOBJ) {
+					feature.type = kv.obj;
+				}
+				ObjTab objs = feature.objs.get(kv.obj);
+				if (objs == null) {
+					objs = new ObjTab();
+					feature.objs.put(kv.obj, objs);
+				}
+				AttMap atts = objs.get(0);
+				if (atts == null) {
+					atts = new AttMap();
+					objs.put(0, atts);
+				}
+				if (kv.att != Att.UNKATT) {
+					atts.put(kv.att, new AttVal(kv.att, kv.conv, kv.val));
+				}
+				break;
 			}
 		}
@@ -594,13 +595,12 @@
 			nedge.last = first;
 			switch (lext) {
-			case NE:
 			case N:
-				if ((fext != Ext.NE) && (fext != Ext.N)) {
+				if ((lext == fext) || (fext != Ext.N)) {
 					nedge.nodes.add(1L);
-					if ((fext != Ext.NW) && (fext != Ext.W)) {
+					if ((fext != Ext.W)) {
 						nedge.nodes.add(2L);
-						if ((fext != Ext.SW) && (fext != Ext.S)) {
+						if ((fext != Ext.S)) {
 							nedge.nodes.add(3L);
-							if ((fext != Ext.SE) && (fext != Ext.W)) {
+							if ((fext != Ext.W)) {
 								nedge.nodes.add(4L);
 							}
@@ -609,13 +609,12 @@
 				}
 				break;
-			case NW:
 			case W:
-				if ((fext != Ext.NW) && (fext != Ext.W)) {
+				if ((lext == fext) || (fext != Ext.W)) {
 					nedge.nodes.add(2L);
-					if ((fext != Ext.SW) && (fext != Ext.S)) {
+					if ((fext != Ext.S)) {
 						nedge.nodes.add(3L);
-						if ((fext != Ext.SE) && (fext != Ext.E)) {
+						if ((fext != Ext.E)) {
 							nedge.nodes.add(4L);
-							if ((fext != Ext.NE) && (fext != Ext.N)) {
+							if ( (fext != Ext.N)) {
 								nedge.nodes.add(1L);
 							}
@@ -624,13 +623,12 @@
 				}
 				break;
-			case SW:
 			case S:
-				if ((fext != Ext.SW) && (fext != Ext.S)) {
+				if ((lext == fext) || (fext != Ext.S)) {
 					nedge.nodes.add(3L);
-					if ((fext != Ext.SE) && (fext != Ext.E)) {
+					if ((fext != Ext.E)) {
 						nedge.nodes.add(4L);
-						if ((fext != Ext.NE) && (fext != Ext.N)) {
+						if ((fext != Ext.N)) {
 							nedge.nodes.add(1L);
-							if ((fext != Ext.NW) && (fext != Ext.W)) {
+							if ((fext != Ext.W)) {
 								nedge.nodes.add(2L);
 							}
@@ -639,13 +637,12 @@
 				}
 				break;
-			case SE:
 			case E:
-				if ((fext != Ext.SE) && (fext != Ext.E)) {
+				if ((lext == fext) || (fext != Ext.E)) {
 					nedge.nodes.add(4L);
-					if ((fext != Ext.NE) && (fext != Ext.N)) {
+					if ((fext != Ext.N)) {
 						nedge.nodes.add(1L);
-						if ((fext != Ext.NW) && (fext != Ext.W)) {
+						if ((fext != Ext.W)) {
 							nedge.nodes.add(2L);
-							if ((fext != Ext.SW) && (fext != Ext.S)) {
+							if ((fext != Ext.S)) {
 								nedge.nodes.add(3L);
 							}
@@ -661,41 +658,27 @@
 			features.get(Obj.LNDARE).add(land);
 		}
+		return;
 	}
 
 	// Utility methods
 	
-	enum Ext {I, N, NW, W, SW, S, SE, E, NE }
+	enum Ext {I, N, W, S, E }
+	class Xnode {
+		double lat;
+		double lon;
+		Ext ext;
+	}
 	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;
 		}
@@ -904,5 +887,5 @@
 		int ec;
 		long lastref;
-		
+
 		public GeomIterator(Geom g) {
 			geom = g;
Index: applications/editors/josm/plugins/seachart/src/s57/S57obj.java
===================================================================
--- applications/editors/josm/plugins/seachart/src/s57/S57obj.java	(revision 31014)
+++ applications/editors/josm/plugins/seachart/src/s57/S57obj.java	(revision 31027)
@@ -178,18 +178,3 @@
 	}
 	
-	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/S57osm.java
===================================================================
--- applications/editors/josm/plugins/seachart/src/s57/S57osm.java	(revision 31027)
+++ applications/editors/josm/plugins/seachart/src/s57/S57osm.java	(revision 31027)
@@ -0,0 +1,65 @@
+/* Copyright 2015 Malcolm Herring
+ *
+ * This is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
+ */
+
+package s57;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import s57.S57obj.*;
+import s57.S57att.*;
+import s57.S57val.*;
+
+public class S57osm {
+
+	static class KeyVal<V> {
+		Obj obj;
+		Att att;
+		Conv conv;
+		V val;
+		KeyVal(Obj o, Att a, Conv c, V v) {
+			obj = o;
+			att = a;
+			conv = c;
+			val = v;
+		}
+	}
+	
+	private static final HashMap<String, KeyVal<?>> OSMtags = new HashMap<String, KeyVal<?>>();
+	static {
+		OSMtags.put("natural=coastline", new KeyVal<>(Obj.COALNE, Att.UNKATT, null, null)); OSMtags.put("natural=water", new KeyVal<>(Obj.LAKARE, Att.UNKATT, null, null));
+		OSMtags.put("waterway=riverbank", new KeyVal<>(Obj.RIVBNK, Att.UNKATT, null, null)); OSMtags.put("waterway=river", new KeyVal<>(Obj.RIVERS, Att.UNKATT, null, null));
+		OSMtags.put("waterway=canal", new KeyVal<>(Obj.CANALS, Att.UNKATT, null, null)); OSMtags.put("waterway=dock", new KeyVal<>(Obj.HRBBSN, Att.UNKATT, null, null));
+		OSMtags.put("waterway=lock", new KeyVal<>(Obj.HRBBSN, Att.UNKATT, null, null)); 
+		OSMtags.put("wetland=tidalflat", new KeyVal<Double>(Obj.DEPARE, Att.DRVAL2, Conv.F, (double)0)); OSMtags.put("tidal=yes", new KeyVal<Double>(Obj.DEPARE, Att.DRVAL2, Conv.F, (double)0));
+		OSMtags.put("natural=mud", new KeyVal<>(Obj.DEPARE, Att.UNKATT, null, null)); OSMtags.put("natural=sand", new KeyVal<>(Obj.DEPARE, Att.UNKATT, null, null));
+		OSMtags.put("highway=motorway", new KeyVal<>(Obj.ROADWY, Att.CATROD, Conv.E, CatROD.ROD_MWAY)); OSMtags.put("highway=trunk", new KeyVal<>(Obj.ROADWY, Att.CATROD, Conv.E, CatROD.ROD_MAJR));
+		OSMtags.put("highway=primary", new KeyVal<>(Obj.ROADWY, Att.CATROD, Conv.E, CatROD.ROD_MAJR)); OSMtags.put("highway=secondary", new KeyVal<>(Obj.ROADWY, Att.CATROD, Conv.E, CatROD.ROD_MINR));
+		OSMtags.put("highway=tertiary", new KeyVal<>(Obj.ROADWY, Att.CATROD, Conv.E, CatROD.ROD_MINR)); OSMtags.put("highway=residential", new KeyVal<>(Obj.ROADWY, Att.UNKATT, null, null));
+		OSMtags.put("highway=unclassified", new KeyVal<>(Obj.ROADWY, Att.UNKATT, null, null)); OSMtags.put("railway=rail", new KeyVal<>(Obj.RAILWY, Att.UNKATT, null, null));
+		OSMtags.put("man_made=breakwater", new KeyVal<>(Obj.SLCONS, Att.UNKATT, null, null)); OSMtags.put("man_made=groyne", new KeyVal<>(Obj.SLCONS, Att.UNKATT, null, null));
+		OSMtags.put("man_made=pier", new KeyVal<>(Obj.SLCONS, Att.UNKATT, null, null)); OSMtags.put("man_made=jetty", new KeyVal<>(Obj.SLCONS, Att.UNKATT, null, null));
+		OSMtags.put("landuse=industrial", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null)); OSMtags.put("landuse=commercial", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null));
+		OSMtags.put("landuse=retail", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null)); OSMtags.put("landuse=residential", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null));
+	}
+	
+	public static KeyVal<?> OSMtag(String key, String val) {
+		KeyVal<?> kv = OSMtags.get(key + "=" + val);
+		if (kv != null) {
+			if (kv.conv == Conv.E) {
+				ArrayList<Enum<?>> list = new ArrayList<Enum<?>>();
+				list.add((Enum<?>)kv.val);
+				return new KeyVal<>(kv.obj, kv.att, kv.conv, list);
+			}
+			return kv;
+		}
+		return new KeyVal<>(Obj.UNKOBJ, Att.UNKATT, null, null);
+	}
+
+}
Index: applications/editors/josm/plugins/seachart/src/s57/S57val.java
===================================================================
--- applications/editors/josm/plugins/seachart/src/s57/S57val.java	(revision 31014)
+++ applications/editors/josm/plugins/seachart/src/s57/S57val.java	(revision 31027)
@@ -1242,25 +1242,3 @@
 	}
 
-	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/ChartImage.java
===================================================================
--- applications/editors/josm/plugins/seachart/src/seachart/ChartImage.java	(revision 31014)
+++ applications/editors/josm/plugins/seachart/src/seachart/ChartImage.java	(revision 31027)
@@ -68,8 +68,8 @@
 		g2.setBackground(Rules.Bwater);
 		g2.clearRect(rect.x, rect.y, rect.width, rect.height);
+		Renderer.reRender(g2, zoom, Math.pow(2, (zoom-12)), SeachartAction.map, this);
 		g2.setPaint(Color.black);
 		g2.setFont(new Font("Arial", Font.BOLD, 20));
 		g2.drawString(("Z" + zoom), (rect.x + rect.width - 40), (rect.y + rect.height - 10));
-		Renderer.reRender(g2, zoom, Math.pow(2, (zoom-12)), SeachartAction.map, this);
 	}
 
