Index: src/uk/me/parabola/splitter/AbstractOSMWriter.java
===================================================================
--- src/uk/me/parabola/splitter/AbstractOSMWriter.java	(revision 428)
+++ src/uk/me/parabola/splitter/AbstractOSMWriter.java	(working copy)
@@ -17,12 +17,15 @@
 import java.io.File;
 
 public abstract class AbstractOSMWriter implements OSMWriter{
-	
+	final static int REMOVE_VERSION = 1;
+	final static int FAKE_VERSION = 2;
+	final static int KEEP_VERSION = 3;
 	protected final Area bounds;
 	protected final Area extendedBounds;
 	protected final File outputDir;
 	protected final int mapId;
-	protected final Rectangle bbox; 
+	protected final Rectangle bbox;
+	protected int versionMethod; 
 	
 
 	public AbstractOSMWriter(Area bounds, File outputDir, int mapId, int extra) {
@@ -36,6 +39,20 @@
 		this.bbox = Utils.area2Rectangle(bounds, 1);
 	}
 
+	public void setVersionMethod (int versionMethod){
+		this.versionMethod = versionMethod;
+	}
+	
+	protected int getWriteVersion (Element el){
+		if (versionMethod == REMOVE_VERSION)
+			return 0;
+		if (versionMethod == FAKE_VERSION)
+			return 1;
+		// XXX maybe return 1 if no version was read ?
+		return el.getVersion();
+
+	}
+	
 	public Area getBounds() {
 		return bounds;
 	}
Index: src/uk/me/parabola/splitter/BinaryMapParser.java
===================================================================
--- src/uk/me/parabola/splitter/BinaryMapParser.java	(revision 428)
+++ src/uk/me/parabola/splitter/BinaryMapParser.java	(working copy)
@@ -111,6 +111,7 @@
 
 			tmp = new Node();
 			tmp.set(id, latf, lonf);
+			tmp.setVersion(nodes.getDenseinfo().getVersion(i));
 
 			if (!skipTags) {
 				if (nodes.getKeysValsCount() > 0) {
@@ -143,6 +144,7 @@
 			double latf = parseLat(i.getLat()), lonf = parseLon(i.getLon());
 
 			tmp.set(id, latf, lonf);
+			tmp.setVersion(i.getInfo().getVersion());
 
 			processor.processNode(tmp);
 			elemCounter.countNode(tmp.getId());
@@ -172,6 +174,7 @@
 
 			long id = i.getId();
 			tmp.setId(id);
+			tmp.setVersion(i.getInfo().getVersion());
 
 			processor.processWay(tmp);
 			elemCounter.countWay(i.getId());
@@ -195,6 +198,7 @@
 			}
 			long id = i.getId();
 			tmp.setId(id);
+			tmp.setVersion(i.getInfo().getVersion());
 
 			long last_mid=0;
 			for (int j =0; j < i.getMemidsCount() ; j++) {
Index: src/uk/me/parabola/splitter/BinaryMapWriter.java
===================================================================
--- src/uk/me/parabola/splitter/BinaryMapWriter.java	(revision 428)
+++ src/uk/me/parabola/splitter/BinaryMapWriter.java	(working copy)
@@ -115,7 +115,10 @@
         //        }
 
         for(Element e : entities) {
-        	b.addVersion(1);
+        	int version = getWriteVersion(e);
+        	if (versionMethod != KEEP_VERSION || version == 0)
+        		version = 1; // JOSM requires a fake version
+        	b.addVersion(version);
         	b.addTimestamp(0);
         	b.addChangeset(0);
         	b.addUid(0);
@@ -127,7 +130,7 @@
       {
         //        StringTable stable = serializer.getStringTable();
         Osmformat.Info.Builder b = Osmformat.Info.newBuilder();
-        if(!omit_metadata) {
+//        if(!omit_metadata) {
           //          if(e.getUser() == OsmUser.NONE && warncount < MAXWARN) {
           //            LOG
           //                .warning("Attention: Data being output lacks metadata. Please use omitmetadata=true");
@@ -140,6 +143,14 @@
           //          b.setTimestamp((int)(e.getTimestamp().getTime() / date_granularity));
           //          b.setVersion(e.getVersion());
           //          b.setChangeset(e.getChangesetId());
+//        }
+        if (versionMethod != REMOVE_VERSION){
+        	int version = getWriteVersion(e);
+        	b.setVersion(version);
+        	b.setTimestamp(0);
+        	b.setChangeset(0);
+        	b.setUid(0);
+        	b.setUserSid(0);
         }
         return b;
       }
Index: src/uk/me/parabola/splitter/Element.java
===================================================================
--- src/uk/me/parabola/splitter/Element.java	(revision 428)
+++ src/uk/me/parabola/splitter/Element.java	(working copy)
@@ -22,7 +22,7 @@
 public abstract class Element {
 	protected ArrayList<Tag> tags; 
 	private long id;
-
+	private int version;
 	
 	public void setId(long id) {
 		this.id = id;
@@ -32,6 +32,14 @@
 		return id;
 	}
 
+	public int getVersion() {
+		return version;
+	}
+
+	public void setVersion(int version) {
+		this.version = version;
+	}
+
 	class Tag {
 		public Tag(String key,String value) {
 			this.key = key;
Index: src/uk/me/parabola/splitter/Main.java
===================================================================
--- src/uk/me/parabola/splitter/Main.java	(revision 428)
+++ src/uk/me/parabola/splitter/Main.java	(working copy)
@@ -149,6 +149,8 @@
 
 	private int searchLimit;
 	
+	private String handleElementVersion;
+	
 	public static void main(String[] args) {
 		Main m = new Main();
 		try{
@@ -577,6 +579,10 @@
 			searchLimit = 1000;
 			System.err.println("The --search-limit parameter must be 1000 or higher. Resetting to 1000.");
 		}
+		handleElementVersion = params.getHandleElementVersion();
+		if (Arrays.asList("remove", "fake" , "keep").contains(handleElementVersion) == false){
+			throw new IllegalArgumentException("the --handle-element-version parameter must be either remove, fake, or keep.");
+		}
 	}
 
 	/**
@@ -825,7 +831,7 @@
 		
 		for (int j = 0; j < allWriters.length; j++) {
 			Area area = areas.get(j);
-			OSMWriter w;
+			AbstractOSMWriter w;
 			if ("pbf".equals(outputType)) 
 				w = new BinaryMapWriter(area, fileOutputDir, area.getMapId(), overlapAmount );
 			else if ("o5m".equals(outputType))
@@ -834,6 +840,16 @@
 				w = new PseudoOSMWriter(area, area.getMapId(), false, overlapAmount);
 			else 
 				w = new OSMXMLWriter(area, fileOutputDir, area.getMapId(), overlapAmount );
+			switch (handleElementVersion) {
+			case "keep": 
+				w.setVersionMethod(AbstractOSMWriter.KEEP_VERSION);
+				break;
+			case "remove": 
+				w.setVersionMethod(AbstractOSMWriter.REMOVE_VERSION);
+				break;
+			default:
+				w.setVersionMethod(AbstractOSMWriter.FAKE_VERSION);
+			}
 			allWriters[j] = w;
 		}
 
Index: src/uk/me/parabola/splitter/O5mMapParser.java
===================================================================
--- src/uk/me/parabola/splitter/O5mMapParser.java	(revision 428)
+++ src/uk/me/parabola/splitter/O5mMapParser.java	(working copy)
@@ -248,7 +248,8 @@
 		lastNodeId += readSignedNum64();
 		if (bytesToRead == 0)
 			return; // only nodeId: this is a delete action, we ignore it 
-		readVersionTsAuthor();
+		int version = readVersionTsAuthor();
+		node.setVersion(version);
 		if (bytesToRead == 0)
 			return; // only nodeId+version: this is a delete action, we ignore it 
 		int lon = readSignedNum32() + lastLon; lastLon = lon;
@@ -274,11 +275,12 @@
 		if (bytesToRead == 0)
 			return; // only wayId: this is a delete action, we ignore it 
 
-		readVersionTsAuthor();
+		int version = readVersionTsAuthor();
 		if (bytesToRead == 0)
 			return; // only wayId + version: this is a delete action, we ignore it 
 		Way way = new Way();
 		way.setId(lastWayId);
+		way.setVersion(version);
 		long refSize = readUnsignedNum32();
 		long stop = bytesToRead - refSize;
 		
@@ -301,12 +303,13 @@
 		lastRelId += readSignedNum64(); 
 		if (bytesToRead == 0)
 			return; // only relId: this is a delete action, we ignore it 
-		readVersionTsAuthor();
+		int version = readVersionTsAuthor();
 		if (bytesToRead == 0)
 			return; // only relId + version: this is a delete action, we ignore it 
 		
 		Relation rel = new Relation();
 		rel.setId(lastRelId);
+		rel.setVersion(version);
 		long refSize = readUnsignedNum32();
 		long stop = bytesToRead - refSize;
 		while(bytesToRead > stop){
@@ -365,7 +368,7 @@
 	 * @throws IOException
 	 */
 	
-	private void readVersionTsAuthor() throws IOException {
+	private int readVersionTsAuthor() throws IOException {
 		int version = readUnsignedNum32(); 
 		if (version != 0){
 			// version info
@@ -375,6 +378,7 @@
 				readAuthor();
 			}
 		}
+		return version;
 	}
 	/**
 	 * Read author . 
Index: src/uk/me/parabola/splitter/O5mMapWriter.java
===================================================================
--- src/uk/me/parabola/splitter/O5mMapWriter.java	(revision 428)
+++ src/uk/me/parabola/splitter/O5mMapWriter.java	(working copy)
@@ -189,7 +189,8 @@
 		ByteArrayOutputStream stream = new ByteArrayOutputStream();
 		long delta = node.getId() - lastNodeId; lastNodeId = node.getId(); 
 		writeSignedNum(delta, stream);
-		stream.write(0x00); // no version info
+		writeVersion(node, stream);
+		//TODO : write version
 		int o5Lon = (int)(node.getLon() * FACTOR);
 		int o5Lat = (int)(node.getLat() * FACTOR);
 		int deltaLon = o5Lon - lastLon; lastLon = o5Lon;
@@ -207,7 +208,7 @@
 		ByteArrayOutputStream stream = new ByteArrayOutputStream();
 		long delta = way.getId() - lastWayId; lastWayId = way.getId();
 		writeSignedNum(delta, stream);
-		stream.write(0x00); // no version info
+		writeVersion(way, stream);
 		ByteArrayOutputStream refStream = new ByteArrayOutputStream();
 		LongArrayList refs = way.getRefs();
 		int numRefs = refs.size();
@@ -229,7 +230,7 @@
 		ByteArrayOutputStream stream = new ByteArrayOutputStream(256);
 		long delta = rel.getId() - lastRelId; lastRelId = rel.getId();
 		writeSignedNum(delta, stream);
-		stream.write(0x00); // no version info
+		writeVersion(rel, stream);
 		ByteArrayOutputStream memStream = new ByteArrayOutputStream(256);
 		for (Member mem: rel.getMembers()){
 			writeRelRef(mem, memStream);
@@ -257,6 +258,20 @@
 		stw_write(REL_REF_TYPES[refType] + mem.getRole(), null, memStream); 
 	}
 
+	private void writeVersion (Element element, OutputStream stream) throws IOException {
+		if (versionMethod == REMOVE_VERSION){
+			stream.write(0x00); // no version 
+			return;
+		}
+		int version = 1;
+		if (versionMethod == KEEP_VERSION)
+			version = element.getVersion();
+		if (version != 0){
+			writeUnsignedNum(version, stream);
+		}
+		stream.write(0x00); // no author or time-stamp info  
+	}
+	
 	private void writeTags(Element element, OutputStream stream) throws IOException {
 		if (!element.hasTags())
 			return;
Index: src/uk/me/parabola/splitter/OSMParser.java
===================================================================
--- src/uk/me/parabola/splitter/OSMParser.java	(revision 428)
+++ src/uk/me/parabola/splitter/OSMParser.java	(working copy)
@@ -104,7 +104,6 @@
 			System.err.println("Node encountered with missing data. Bad/corrupt osm file? id=" + idStr + ", lat=" + latStr + ", lon=" + lonStr + ". Ignoring this node");
 			return;
 		}
-
 		long id = Long.parseLong(idStr);
 		double lat = Convert.parseDouble(latStr);
 		double lon = Convert.parseDouble(lonStr);
@@ -111,6 +110,8 @@
 
 		currentNode = new Node();
 		currentNode.set(id, lat, lon);
+		currentNode.setVersion(parseVersion());
+
 		state = State.Node;
 	}
 
@@ -117,6 +118,7 @@
 	private void startWay() {
 		currentWay = new Way();
 		currentWay.setId(getLongAttr("id"));
+		currentWay.setVersion(parseVersion());
 		state = State.Way;
 	}
 
@@ -123,9 +125,17 @@
 	private void startRelation() {
 		currentRelation = new Relation();
 		currentRelation.setId(getLongAttr("id"));
+		currentRelation.setVersion(parseVersion());
 		state = State.Relation;
 	}
 
+	private int parseVersion () {
+		String versionStr = getAttr("version");
+		if (versionStr == null)
+			return 0;
+		return Integer.parseInt(versionStr);
+		
+	}
 	private void processNode(CharSequence name) {
 		if (name.equals("tag")) {
 			if (!skipTags)
Index: src/uk/me/parabola/splitter/OSMXMLWriter.java
===================================================================
--- src/uk/me/parabola/splitter/OSMXMLWriter.java	(revision 428)
+++ src/uk/me/parabola/splitter/OSMXMLWriter.java	(working copy)
@@ -57,7 +57,9 @@
 
 	private void writeHeader() throws IOException {
 		writeString("<?xml version='1.0' encoding='UTF-8'?>\n");
-		writeString("<osm version='0.5' generator='splitter' upload='false'>\n");
+		String apiVersion = (versionMethod == REMOVE_VERSION) ? "version='0.5'" : "version='0.6'";
+			
+		writeString("<osm " + apiVersion + " generator='splitter' upload='false'>\n");
 
 		writeString("<bounds minlat='");
 		writeLongDouble(Utils.toDegrees(bounds.getMinLat()));
@@ -88,6 +90,8 @@
 		writeDouble(node.getLat());
 		writeString("' lon='");
 		writeDouble(node.getLon());
+		if (versionMethod != REMOVE_VERSION)
+			writeString("' version='" + getWriteVersion(node));
 		if (node.hasTags()) {
 			writeString("'>\n");
 			writeTags(node);
@@ -95,11 +99,14 @@
 		} else {
 			writeString("'/>\n");
 		}
+		
 	}
 
 	public void write(Way way) throws IOException {
 		writeString("<way id='");
 		writeLong(way.getId());
+		if (versionMethod != REMOVE_VERSION)
+			writeString("' version='" + getWriteVersion(way));
 		writeString("'>\n");
 		LongArrayList refs = way.getRefs();
 		for (int i = 0; i < refs.size(); i++) {
@@ -115,6 +122,8 @@
 	public void write(Relation rel) throws IOException {
 		writeString("<relation id='");
 		writeLong(rel.getId());
+		if (versionMethod != REMOVE_VERSION)
+			writeString("' version='" + getWriteVersion(rel));
 		writeString("'>\n");
 		List<Relation.Member> memlist = rel.getMembers();
 		for (Relation.Member m : memlist) {
Index: src/uk/me/parabola/splitter/args/SplitterParams.java
===================================================================
--- src/uk/me/parabola/splitter/args/SplitterParams.java	(revision 428)
+++ src/uk/me/parabola/splitter/args/SplitterParams.java	(working copy)
@@ -115,4 +115,7 @@
 	@Option(defaultValue = "200000", description = "Search limit in split algo. Higher values may find better splits, but will take longer.")
 	int getSearchLimit();
 
+	@Option(defaultValue = "remove", description = "Define how splitter treats version info in the osm data. Can be remove, fake, or keep")
+	String getHandleElementVersion();
+
 }
