Use a GPS Tracker in a web application

02-11-2015 07:56 AM
New Contributor II


I am using this GPS tracker( ).

I want now to get real time movement data locations on top of my basemap service using the ArcGIS JS API and without getting to use GeoEvent processor Extension

I have done my research and I found that there is a possibility to use this library(fvdm/nodejs-tk102 · GitHub‌)

Has anybody got any experience setting this up before?

I need more details and guidance please.

0 Kudos
8 Replies
Occasional Contributor II

that's a pretty loaded question and will require some thought based on your responses.  Do you already have Node up and running?  What's your productions environment, windows, linux?

0 Kudos
New Contributor II

I know it is a pretty important question as well to me right now.

I don't have a Node up on running! I am very new to this processing. For me it is almost in R&D.

My production environment is Windows, but I still can work with a Linux Desktop through a virtual partition within my current machine hopefully.

Do you think the tutorial is a good resource to follow even if the GPS Tracker is not the same?

I recognize though some processes which are mutual to my GPS Tracker TK-102 which is a Siemens and not a Xexun !

0 Kudos
New Contributor II

I'm not a GPS tracker guy, so take that I don't think the differences will be major with a grain of salt.  To get started with Node in a windows environment, I would recommend downloading Chocolatey Gallery and using that as you windows package manager.  then from your command line you can do this

C:\> choco install nodejs.install

I suppose you'll need to have your device connected to your machine so that it can communicate to your open port.

If connecting your machine to your device is not an option, I would suggest using OpenShift to get things up and going on the open web for free.  Sign up for an account and follow these instructions

OpenShift Online for Windows | OpenShift Developers

Once you get Node setup on your machine or OpenShift, come back and we'll go to the next step.

If you need help getting set up, let me know

New Contributor II

There is no need to install the NodeJS-TK102 then, I guess.

I have now successfully installed the NODEJS :


What is the next step please? Connect the GPS Tracker to the NodeJS?

0 Kudos
New Contributor II

I would still install NodeJS-TK102.  From your command line navigate to the directory you want to operate from (you may have to create it)  For prototypes, I put things in my c>projects directory, so I would create a folder under C:\projects\ called tk102, then I create a folder under that called server.  So mine would be C:\projects\tk102\server

once you are in that directory run this command taken from the github repo you posted npm install tk102

That will install the NodeJS-TK102 library for you.

next, you'll want to prepare your device for transponding your coords, do you have instructions on that, or the manual you can link to?

after that you would create a node project, pull in the library and interact with it's api.  I can post about that later

0 Kudos
New Contributor II

I have installed NODEJS-TK102 successfully.

I have set-up one point coordinate and many using auto tracking and following the manual instructions.

I am ready for the next step which is creating a node project. I have also connected my GPS Tracker to my laptop. Can you give me more details about how to interact with it now using the Node and collect the required coordinates?

0 Kudos
New Contributor II

I recommend that you get an IDE if you don't have one.  I recommend WebStorm, but it's only free for a month, then you'll have to pay.  Some alternatives are Visual Studio, Aptana, search this forum for others

next you'll go on your command line and navigate to your project directory, mine is C:\projects\tk106\server\src

the next step will walk you through creating your package.json file, it will ask you want you want to call your application file, it defaults to index.js, I call mine server.js, so anywhere you see server.js below, replace it with the name you give your file

type 'npm init'

This will help you create your package.json file which is the package manager for your file.  It will ask you a few questions, then create the file.

I believe you said you installed tk102 already, if so, skip this step:

     Once the file is created, type 'npm install tk102 --save'

     the --save option will be sure to add the dependency into your package.json file

My personal preference is to install nodemon as well, so that my server auto restarts as I make changes

I do that by typing 'npm install nodemon --save-dev'

This will add nodeman as a dependency to your development environment inside your package.json file

if you installed nodemon do the following:

    Now open your package.json file

    remove the line "main": "server.js",

    add this line in the scripts object above test

    "start": "NODE_ENV=local ./node_modules/.bin/nodemon server.js",

Depending on what you stated your default node file would be, create that file.  I created a file named server.js

Open your server.js file and follow the example from the tk106 repo:

type the following:


'use strict';

var server = require('tk102');


    port: 1337


server.on( 'listening', function( listen ) {

    console.log('listening on port: ' + listen.port);


server.on( 'data', function( raw ) {

    console.log( 'Incoming data: '+ raw )


server.on( 'track', function( gps ) {

    console.log( gps )



at this point, you should be able connect your device to your server.  if things don't work, then you'll have to dig into the tk102 server source code and update it. it's located in node_modules\tk102\tk102.js

if you attach the manual, I may be able to help further as any errors will probably be in the parser.  Hopefully you get something in the console.log( 'Incoming data: '+ raw ) statement

let me know how that goes.

sometimes you may have to stop node from running, in that case I run this on my mac

lsof -n -i :1337


node    1887 alexbostic   14u  IPv4 0x7e6cfdb8acf18bf5      0t0  TCP *:hbci (LISTEN)

sudo kill -9 1887

lsof -n -i :1337

npm start

0 Kudos
New Contributor II

I own the GPS tracker USB cable. So, when I get to connect it with my computer, it doesn't really react to it.

How do I interact with my computer then knowing that I am planning for a real-time tracking solution later on?

I am expecting the following scenario as I use my tracker:

Receive signals from my GPS tracker while outdoors when requesting my position or proceed for a real-time tracking using the device, something like:

Please find herein below the URL to the GPS tracker guide:

And Thank you again ! You have been so helpful till now !

0 Kudos