Index: src/uk/me/parabola/mkgmap/filters/ShapeMergeFilter.java
===================================================================
--- src/uk/me/parabola/mkgmap/filters/ShapeMergeFilter.java	(revision 4767)
+++ src/uk/me/parabola/mkgmap/filters/ShapeMergeFilter.java	(working copy)
@@ -33,6 +33,8 @@
 import uk.me.parabola.mkgmap.osmstyle.WrongAngleFixer;
 import uk.me.parabola.mkgmap.reader.osm.FakeIdGenerator;
 import uk.me.parabola.mkgmap.reader.osm.GType;
+import uk.me.parabola.mkgmap.reader.osm.Way;
+import uk.me.parabola.util.GpxCreator;
 import uk.me.parabola.util.Java2DConverter;
 
 
@@ -59,7 +61,8 @@
 	public ShapeMergeFilter(int resolution, boolean orderByDecreasingArea) {
 		this.resolution = resolution;
 		this.orderByDecreasingArea = orderByDecreasingArea;
-		maxPoints = PolygonSplitterFilter.MAX_POINT_IN_ELEMENT;
+		int shift = 24 - resolution;
+		maxPoints = PolygonSplitterFilter.MAX_POINT_IN_ELEMENT * (1 << shift);
 	}
 
 	/**
@@ -102,9 +105,9 @@
 		}
 		if (p1 < usableShapes.size())
 			mergeSimilar(usableShapes.subList(p1, usableShapes.size()), mergedShapes);
-//		for (int i = 0; i < mergedShapes.size(); i++) {
-//			testSplit(mergedShapes.get(i));
-//		}
+		for (int i = 0; i < mergedShapes.size(); i++) {
+			testSplit(mergedShapes.get(i));
+		}
 		return mergedShapes;
 	}
 	
@@ -217,7 +220,7 @@
 			if (all.isEmpty())
 				continue;
 			
-			
+
 //			final boolean print = false &&"{0, 1, 2, 3, 5, 7, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}".equals(all.toString()); 
 
 //			if (print) {
@@ -711,33 +714,27 @@
 		}
 	}
 
-//	private void testSplit(MapShape shape) {
-//		if (shape.getPoints().size() < PolygonSplitterFilter.MAX_POINT_IN_ELEMENT)
-//			return;
-//		PolygonSplitterFilter splitter = new PolygonSplitterFilter();
-//		final long testVal = Math.abs(ShapeMergeFilter.calcAreaSizeTestVal(shape.getPoints()));
-//		for (int myShift = 0; myShift <= 24 - resolution; myShift++) {
-//			List<MapShape> outputs = splitter.testSplit(shape, myShift);
-//
-//			long sumSplit = outputs.stream()
-//					.mapToLong(s -> Math.abs(ShapeMergeFilter.calcAreaSizeTestVal(s.getPoints()))).sum();
-//			long delta = testVal - sumSplit;
-//			double ratio = (double) testVal / sumSplit;
-//			if (Math.abs(delta) > SINGLE_POINT_AREA * 2 && Math.abs(ratio - 1) > 0.001) {
-//				String path = "e:/ld/";
-//				log.error("testing  split shape", GType.formatType(shape.getType()), "at shift", myShift);
-//				List<Coord> merged = shape.getPoints();
-//				merged.forEach(Coord::resetHighwayCount);
-//				merged.forEach(Coord::incHighwayCount);
-//				List<Coord> many = merged.stream().filter(p -> p.getHighwayCount() > 2).collect(Collectors.toList());
-//				GpxCreator.createGpx(path + "o", merged, many);
-//				for (int i = 0; i < outputs.size(); i++) {
-//					GpxCreator.createGpx(path + "s_" + i, outputs.get(i).getPoints());
-//				}
-//				log.error("split failed?, ratio:", ratio);
-//				long dd = 4;
-//			}
-//		}
-//	}
-}
+	private void testSplit(MapShape shape) {
+		if (shape.getPoints().size() < PolygonSplitterFilter.MAX_POINT_IN_ELEMENT)
+			return;
+		PolygonSplitterFilter splitter = new PolygonSplitterFilter();
+		final long testVal = Math.abs(ShapeMergeFilter.calcAreaSizeTestVal(shape.getPoints()));
+		for (int myShift = 0; myShift <= 24 - resolution; myShift++) {
+			List<MapShape> outputs = splitter.testSplit(shape, myShift);
 
+			long sumSplit = outputs.stream()
+					.mapToLong(s -> Math.abs(ShapeMergeFilter.calcAreaSizeTestVal(s.getPoints()))).sum();
+			long delta = testVal - sumSplit;
+			double ratio = (double) testVal / sumSplit;
+			if (Math.abs(delta) > SINGLE_POINT_AREA * 2 && Math.abs(ratio - 1) > 0.001) {
+				String path = "e:/ld/";
+				log.error("testing  split shape", GType.formatType(shape.getType()), "at shift", myShift);
+				List<Coord> merged = shape.getPoints();
+				merged.forEach(Coord::resetHighwayCount);
+				merged.forEach(Coord::incHighwayCount);
+				List<Coord> many = merged.stream().filter(p -> p.getHighwayCount() > 2).collect(Collectors.toList());
+				GpxCreator.createGpx(path + "o", merged, many);
+				for (int i = 0; i < outputs.size(); i++) {
+					GpxCreator.createGpx(path + "s_" + i, outputs.get(i).getPoints());
+				}
+	
