A Java Based Taxi Position Tracke
Posted on

Jazi Eko Istiyanto (1), Andi Sunyoto (2)
(1) Laboratory of Electronics and Instrumentation Physics Department, Gadjah Mada University
(2) AMIKOM Computer College Yogyakarta
e-mails : jazi@ugm.ac.id, myandisun@yahoo.com

A taxi monitoring and tracking system, based on the programming language Java, has been designed and implemented. Embedded in the taxi are a cellular phone and a GPS-receiver module. The taxi central office is capable of graphically locating the queried taxi on the city map displayed on the computer screen. The cellular phone is connected to the central office via a GPRS connection.
Keywords: J2ME, GPS, GPRS, monitoring, tracking
I. Introduction
Taxi is a means of transportation popular in the cities.  Taxis follow flexible routes
unlike buses or trains. An application that can monitor and track taxi position is
therefore desirable. Taxi companies need also to know the status of the taxis, i.e
whether they are carrying passengers or not. Traditionally, a taxi driver communicates with the central  office using radio communication technologies such a handy-talkies. The paper presents a taxi monitoring and tracking system based on the Java programming language. Position and status monitoring and tracking of taxis are carried out by embedding a hardware device in the taxi. The device consists of a set of GPS (Global Positioning System) receiver module which determines the taxi location and a set of communicating devices  which  enable  the  position information to be periodically reported to the taxi central office.

2. Literature Survey
Our work has been inspired by the paper of Fallon  (2000)  on  the  design  and implementation of Dublin bus tracking system and the work of Hutapea (2003) on
the design and implementation of a train collision avoidance system. While bus can be out of route, due to e.g hijacking, train has a fixed route.  Bus being out of route is not a normal condition, while taxis do not follow fixed routes.

3. Global Positioning Systems and Java
GPS (Global  Positioning System) is a satellite-based navigation system consisting
of 24 satellites communicating to each other. To get an information on the position of a GPS-receiver at least 3 satellites are required. These satellites process signals from the GPS-receiver  to establish a  position information. The signals are processed into way-points,  which are point coordinates expressed in latitudes and longitudes. Physically,  a GPS receiver consists of integrated circuits which can be used in many applications such as in cars, ships, aircraft,  in agricultural applications,  etc. GPS-receivers  can  be  integrated  in computers, laptops, and other devices. GPS-receivers  produce  standard  outputs containing  information  related  to geographical data.  One of the standard format is the NMEA-0183. Some GPS-receivers are equipped with displays such as LCDs, while others are not.
The latter is known as a GPS-receiver module. A GPS-receiver module sends data in a NMEA-0183 standard format via a communication media, such as cables or wireless e.g bluetooth.

3.1 NMEA (National Marine Electronics Association) 0183 Standard
Originally,  NMEA-0183 is an industry standard for  interfacing naval  devices introduced in 1983. NMEA-0183 contains information related to geography such as latitude and longitude.  However,  the receiving devices need to process the NMEA-0183 data into a human-readable information.

3.2. J2ME (Java 2 Micro Edition)
J2ME is a part  of J2SE targeted at implementation on embedded systems devices which lack requirement such as run-time memory suitable for J2SE. Embedded systems  are special-purpose processors embedded into larger devices. A Java program on a computer (J2SE) requires a JVM (Java Virtual Machine), while a Java program on a small device (J2ME) requires  a Kilobyte Virtual Machine (KVM). KVM requires a run-time memory as big as  128 kilobytes up to  512 kilobytes only. The Java 2 Micro Edition (J2ME) is a collection of  API (Application Programing Interface) suitable for  embedded system. J2ME consists of architecture, profiles, and optional packages.

3.3. J2ME Architecture
The  J2ME architecture  consists  of configuration,  profiles,  and  optional packages  which is  implemented and developed by choosing the available APIs and combined to build a run-time Java application suited to the intended devices and application areas.
3.4. J2ME Configuration
The J2ME configuration consists of the virtual machine and a minimal set of class libraries. J2ME has two configurations : Connected Limited Device Configuration (CLDC),  Connected Device Configuration
3.5.MIDP (Mobile Information Device Profile)
To be able to create an application, a programmer has to combine the CLDC and the MIDP profile. In general, there are many issues in an application, MIDlet, that have to be taken into account. These are its life cycle, its user interface,  its  command handling,  its deployment, and its application management.
3.6.Optional Packages
The J2ME platform can be extended buy adding optional packages by using a stack technology available in the CLDC or CDC and connected to MIDP. J2ME APIs are available for database connection, wireless messaging, multimedia, bluetooth, and web service.  Because optional  packages are modular,  developers may avoid using unnecessary functions which may degrade performance by just adding a package which are really required.
4. Design and Implementation
The system consists of three blocks:
blocks I, II, and III as depicted in Figure 2. Block I comprises of the GPS-receiver module and a cellular handset supporting at least  a GPRS (General  Packet  Radio Services) connection. Block II  consists of  a web server and a database server. Block I is responsible of determining the taxi location, and sending the location information to Block II.
Figure 2 Architecture of the System Block I and II are connected via Internet (http). Block III is the monitoring computer in the taxi central office. Block II and Block III can be connected via cable or wi-fi. Block III visualizes taxis’ positions on the computer screen so that the users see the
taxis’ position in terms of the city map, not the geographical coordinates (longitude and latitudes). Block III visualization software is written in Visual Basic. Block II is also for data recording in the database.
4.1 Reading the NMEA data from the GPS receiver
Position information can be extracted in stages:

4.1.1. Connecting the cellular phone and the GPS receiver via Bluetooth.

The address of the GPS receiver has to be determined  first.  The  address  of
00054f002823 and port number 1 have been used. In general, the connection follow a format of (btspp: device address and port
number).  Next  is  creating  an Input StreamReader using a connection that
has been open.
String url =
ction connection =
java.io.InputStreamReader  in  =  new
4.1.2. Reading the Data
In this session, data is sent from the GPS receiver subsequently appended until an end of line (ASCII 13) is found. To get the next line, a line feed (ASCII 10) must be inserted.
in = new
while ( (ch = in.read()) != ‘\n’)
txtNMEA += (char) ch;
txtNMEA = txtNMEA.substring(0,
txtNMEA.length() – 1);
String output;
int in;
while ((in = reader.read()) !=
txtNMEA += (char) in;
txtNMEA = txtNMEA.substring(1,
txtNMEA.length() – 1);
4.1.3. The Parsing Process
A parser separtes records into data-value by identifying  delimiting characters , in this case a comma (“,”).  Thus,  by using method next (returning a String) and method hasNext (returning a true whenever there still exists data to be processed). Using method String standar index Of or  substring, data can be extracted.
public void Parser(){
currentPositon = 1;
nextPosition =

TYPE_NMEA = next();
UTCPosition  = next();
State = next();
Latitude = next();
LatitudeIndicator =
. . . .
private boolean hasNext(){
return nextPosition != -1
&& currentPositon <=

private String next() throws
if (!hasNext())
throw new

String next =

currentPositon =
nextPosition + 1;
nextPosition =
return next;
4.1.4. Data Conversion
Data sent by the GPS receiver is not always
readily displayed. Some data may require
conversion. In this case, the speed is in
knots  (1 knot = 1.50779 mile/hour = 1.65
km/hr) which require a conversion to km/hr.
J2ME does not recognize a floating-point
data type. Therefore, a new class must be
created to do the conversion from a String
int SpeedX =
SpeedOverGround =  MathFP.toString(
MathFP.round(SpeedX, 2)) + ” km/h”;
4.2.Sending the data to the web server
Data (the longitude, the latitude, and the id of the taxi) is sent to the web server via a GPRS connection. The sending of the data utilizes an embedded application in the cellular phone. This application is written in the programming language Java (J2ME). The cellular phone and the GPS receiver are communicating using Bluetooth.
public void sendToWebServer(){
sc  =  (StreamConnection)
os = sc.openDataOutputStream();
dos = new DataOutputStream(os);
is = sc.openInputStream();
dis = new DataInputStream(is);
4.3.Database Server and the Web Server
Web server communicates with the GPS receiver module. The data received by the web server is then stored in the database by the database server.
4.3.1. Database Server
There are two tables:
Table GPS
NoPolisi varchar(50) NOT
NmDriver varchar(50) NOT
AlmtDriver varchar(50)
Table Track
GtTgl datetime DEFAULT
GetDate() ,
GtLong varchar (50) NULL ,
GtLat varchar (50) NULL ,
GtSpeed varchar (50) NULL
GtStatus varchar (50) NULL
GtValid varchar (50) NULL
View QlastPosition
SELECT IdGps, GtLong, GtLat,
GtStatus, GtTgl
FROM GpsTrack
4.3.2. Web Server
The following are scripts (in Visual Basic)
for connection to the database:
Dim strConn
Dim dbc
Set dbc =
strConn =
ndisun;Persist Security
Info=True;User ID=andi;Initial
dbc.Open strConn
IdGps = Request(“IdGps”)
GtLong = Request(“GtLong”)
GtLat = Request(“GtLat”)
GtStatus = Request(“GtStatus”)
GtSpeed = Request(“GtSpeed”)
GtValid = Request(“GtValid”)
SqlGps = SqlGps & ” VALUES(‘” &
IdGps & “‘,'” & GtLong & “‘,'” &
GtLat & “‘,'”
SqlGps = SqlGps & GtStatus &
“‘,'” & GtSpeed & “‘,'” & GtValid
& “‘)”
dbc.Execute (SqlGps)
4.4. Visualization
To facilitate the visualization, the database
has  be  equipped  with  the  View
QlastPosition which stores the last positions
of the taxis.
Figure 2 Visualization of taxis’ positions
The map is set using the following code
gcsWGS1984.Type = moGeoCS_WGS1984
dc.Database = App.Path & “\SHP”
Set lyrJalan = New MapLayer
Set lyrJalan.GeoDataset =
Set lyrJalan.CoordinateSystem = proType
lyrJalan.Symbol.Color = moRed
lyrJalan.Symbol.Size = 1.2
lyrJalan.Symbol.SymbolType = moLineSymbol
Map1.Layers.Add lyrJalan
Set Map1.CoordinateSystem = proType
Points in the map are plot using the
following code
Public Sub AddPoint(xLong, xLat)
Dim pt As MapObjects2.Point
Set pt = New MapObjects2.Point
Map1.TrackingLayer.AddEvent pt, 0
End Sub
Figure 3 Taxi Tracking Visualization
Figure 4 Taxi Position Determination on the City Map
5. Discussion
Figures 2, 3, and 4 presents snapshots of the system in action. Users in the taxi central office are capable of locating the taxi position together with the details of the taxi, such as the plate number (the police registration), the driver’s name, etc.
6. Conclusion and future work
The results presented in this paper is mainly on the building blocks (hardware and software) of the system. It has been verified empirically  that  the  system works. However, works need to be carried out related to the practicality aspects of the system especially its performance and reliability

[1] Sun Microsystems, Inc, 2000;  User’s Guide Wireless Toolkit, Version 2.0
Java™ 2 Platform, Micro Edition
[2] Fallon, E., 2000:”Dublin Bus Tracking Service Design and implementation of a device  independent  passenger information”, Technical Report
[3] Hutapea, M.I, 2003: “Train Position Visualization” (in Indonesian),  M.Sc
Thesis, Computer Science, UGM

Jazi Eko Istiyanto completed a Ph.D in Electronic  Systems Engineering (1995) and an M.Sc in Computer Science (1988) from University of Essex, UK. He is now the Head of  the B.Sc. Program in Electronics  and Instrumentation  and  teaches/supervises M.Sc/Ph.D students in the Departments of Computer Science, Electrical Engineering, and Physics at  Gadjah Mada University.
Andi Sunyoto completed a B.Sc in  Computer  Science  from
AMIKOM Computer  College, Yogyakarta. He is now pursuing an M.Sc in Computer Science at Gadjah Mada University and a lecturer at AMIKOM Computer College, Yogyakarta

This entry was posted in Research by cendhika. Bookmark the permalink.