Posts Tagged ‘free sofware’

Reading .OV2 TomTom POI Files using Java

December 31st, 2009

I’m posting today some source code about the famous TomTom One .OV2 file formats. These files are the one used by TomTom to store Point of Interest information within their navigation systems. However such format is proprietary, the data specs can be found in the TomTom website (see this PDF at section 2.4). I wrote down a simple procedure that gathers record by record only the simple POI records. Actually the OV2 format is a little bit more complicated than a simple list of POIs and it can be subjected to changes and version incompatibilities. I tested it with POIs taken from my TomTom ONE XL and ti worked great, however if the OV2 files contains proprietary or special record types (not specified in TomTom data sheets) these procedures will simply stop since it is not possible for this format to distinguish between a corrupted file or non standard encoding.

I hope you’ll find it interesting.

package readers;

import java.io.FileInputStream;
import java.io.IOException;

public class OV2RecordReader {

	public static String[] readOV2Record(FileInputStream inputStream){
		String[] record = null;
		int b = -1;
		try{
			if ((b = inputStream.read())> -1) {
				// if it is a simple POI record
				if (b == 2) {
					record = new String[3];
		    	    long total = readLong(inputStream);

		    	    double longitude = (double) readLong(inputStream) / 100000.0;
		    	    double latitude = (double) readLong(inputStream) / 100000.0;

		    	    byte[] r = new byte[(int) total - 13];
		    	    inputStream.read(r);

		    	    record[0] = new String(r);
		    	    record[0] = record[0].substring(0,record[0].length()-1);
		    	    record[1] = Double.toString(latitude);
		    	    record[2] = Double.toString(longitude);
		    	}
				//if it is a deleted record
				else if(b == 0){
					byte[] r = new byte[9];
		    	    inputStream.read(r);
				}
				//if it is a skipper record
				else if(b == 1){
					byte[] r = new byte[20];
		    	    inputStream.read(r);
				}
				else{
					throw new IOException("wrong record type");
				}
			}
			else{
				return null;
			}
		}
		catch(IOException e){
			e.printStackTrace();
		}
		return record;
	}

	private static long readLong(FileInputStream is){
		long res = 0;
		try{
			res = is.read();
			res += is.read() <<8;
			res += is.read() <<16;
			res += is.read() <<24;
		}
		catch(IOException e){
			e.printStackTrace();
		}
		return res;
	}
}

Choosing the perfect Free Software License

August 25th, 2009

Every time you start developing a new piece of software that needs external libraries to be used and integrated, the licensing dilemma strikes again. If you are a developer of a well standardized software company you can have stronger restrictions on the licenses to be used (even a list of usable licenses), however when you have to start your software from scratch, or start a software “business idea”, it is important to know something more on what you can take and what you can reuse without breaking somebody’s heart. I would like to dedicate this “in progress” post to collect in one page a brief description of the major families or licenses that can be used while developing free software but with possible commercial purposes! I hope it will help and I warmly advise anybody that would suggest any further detail to post a comment and I will be glad to integrate my content with that!

Apache License 2.0

  • Free Software
  • OSI Compatible
  • Linking from code with a different license
  • no Copyleft
  • GPL v3 Compatible

software can be redistributed in any other license, but should be noticed that Apache software is included
Two files that must be put at the top directory of redistributed software packages:

* LICENSE – a copy of the license itself.
* NOTICE – A “notice” text document listing the names of licensed libraries used, together with their developers.

In every licensed file, any original copyright or patent notices in redistributed code must be preserved, and in every licensed file changed a notification must be added stating that changes have been made to that file.

Gnu LGPL License

  • Free Software
  • OSI Compatible
  • Linking from code with a different license
  • Copyleft
  • GPL Compatible

an author may, through a copyleft licensing scheme, give every person who receives a copy of a work permission to reproduce, adapt or distribute the work as long as any resulting copies or adaptations are also bound by the same copyleft licensing scheme.

primarly used for software libraries; has copyleft restrictions. it is something in between GPL and BSD/APACHE like licenses.

BSD Licenses

  • Free Software
  • OSI Compatible
  • Linking from code with a different license
  • no Copyleft
  • GPL Compatible

Eclipse Public License

  • Free Software
  • OSI Compatible
  • Linking from code with a different license
  • Copyleft
  • no GPL  Compatible

is designed to be business friendly. allows developers to create their own licenses on the portion of the codes that are added.

Academic Free License

  • Free Software
  • OSI Compatible
  • Linking from code with a different license
  • no Copyleft
  • GPL  Compatible unknown

considered redundant specifically to the Apache License 2.0

MIT License

considered a duplicate of BSD-like licenses