Adding Location Based Services for the Web - Part 1

By Robert Chou

Every business - whether in banking, service, manufacturing, retail, or anything in between - can benefit from Location Based Services (LBS) on their website.In addition to maps and directions, LBS allows customers to locate branches, service centers, stores or any points of interest near their home.Businesses can use LBS to locate its customers, manage its supply chain, and to implement its business rules.With software development kits (SDKs) from LBS providers like Kivera ( and Webraska (, adding basic LBS functionality can take less than one day.

In this article, I'll compare programming APIs from two LBS providers, Kivera and Webraska, by implementing some web functionality for a fictitious auto dealer.I'll start with a "shuttle service" page where customers can check if their address is within the shuttle's 10 mile service radius.Next, I'll reuse and enhance the code to create a "driving directions" page for customers.

LBS Providers

Kivera is a location-based technology and solution provider that enables businesses to deliver private-label, location services.Their customers include American Automobile Association (AAA), BeVocal, Denso, HeyAnita, MobileID, OnMobile and Wirenix.

Webraska provides software solutions to develop location-based applications for the telecommunications and the automotive industries.Their customers include Airtel, Belgacom, Blu, Borg, CMG, Ericsson, KPN, IBM, M1, Nortel, Openwave, Oracle, Orange, Pacific Access, SFR, Telecom Italia Mobile, Vizzavi and VoiceStream.

Both LBS providers offer Java APIs in their SDKs so I've provided sample code in the form of server side JSP pages.The samples run under Tomcat 3.2 ( and should run under any J2EE Application Server.I'll assume you're familiar with Java server side programming and focus mainly on the LBS code.The source code is available in the resource section at the end of this article.Setup for both venders is an easy three step process: download SDK, add jar file(s) to your servlet engine's path or context path, and register for LBS server connectivity parameters.

In general LBS terms, you'll need to geocode an address to a vendor specific navigation point.With the start and stop points, you can generate a routing object.You can get the distance and directions from this routing object.You can also generate a map based on this routing object.If you want to get fancy, you can also generate maps for the start point, stop point, and points along the route.Both implementations are so similar that I'll describe them together and present the code side by side.


Start by contacting Kivera (through their website) for an evaluation kit.It includes documentation, libraries, sample code, and connectivity information to an evaluation server.Kivera does not have a developer website to share tips or ask questions but the kit is very complete.Documentation is in the form of PDF documents.It's very detailed and has good explanations of small code segments.For quick reference, however, it lacks Javadocs for the Java API.Lots of sample code is this kit's strong point.

For Webraska, they have a developer website with discussion forums.You can download documentation, libraries and sample code online, but you'll have to submit a request for 30 day access to their LBS services.They provide plenty of documentation both in PDF format and in Javadoc format for the Java API.The Javadocs are low in comments but still very useful for quick reference.As for sample code, they provided only one sample program for their Java API, which didn't do much more than connect and geocode.

Fortunately, Webraska provides an application, called the "Request Generator", which allows you to exercise their API using a GUI.This application makes their protocol almost transparent in that you can see exactly what is being passed into the server and what is being sent back from the server.You can also test and probe the server's capabilities and peculiarities with this tool.Once you've practice getting the right data from the server, you simply convert the steps into code and use the Javadocs to lookup the API needed to extract the data you want.

Before I go into more implementation details, let's look at what I'm going to build.For starters, lets mock up the HTML pages for the shuttle service and driving directions (see Figures 1, 2, and 3).These will be written as JSP pages and as views in a MVC pattern (model/view/controller).The controller can be a servlet or, in our case, another JSP page.Since you're mainly interested in the LBS code, I'll be examining parts of the controller code only.


Published Thursday, December 20th, 2001

Written by Robert Chou

If you liked this article subscribe to our newsletter...stay informed on the latest geospatial technology

© 2016 Directions Media. All Rights Reserved.