Sunday, May 20, 2007

Building a Location Based Map and Yellow Pages Service

Location based services have become quite widespread in recent times. With so many online services providing GIS information, it has become relatively easy to create a location based service. Here I present some of the learning from my involvement in one such assignment.

I take an example of online location based yellow pages service. This will involve maps, positioning, geo-coding and yellow pages.

Understanding Latitudes and Longitudes

We all know what latitudes and longitudes are. But it is useful to read these Wikipedia articles on latitude and longitude in some more detail. Particularly the standard notations and mathematics related to geographic coordinates.

Some more discussions on the mathematics (geometry) of latitudes are discussed in Particularly useful are the discussions on area calculation and distance calculation.

Map providers

Google and Yahoo are the most popular providers of map images for anyone to use. There are no charges for using these maps. Both have easy to use AJAX, HTTP, and flash APIs to display maps.

Yahoo seems to be providing several flavors of its API including one for use in flash, which is quite useful for flash based applications. Yahoo maps also provide a version of the API less dependent on AJAX thus making it more 'server programmable'.

One has to register at their site to get a license code that needs to be embedded while calling the API.

Both Google and Yahoo have APIs that make it easy to overlay the map with information like markers, place names, polylines for displaying routes, pictures and much more.

This ability of layering own information on the map has let to people building a plethora of useful map mashups. Google Maps Mania has lots of examples of mashups using Google maps. A book from Wrox called "Yahoo! Maps Mashups" is on how to use the Yahoo maps APIs to create your own mashups.

Providers like Maporama also have complete product suites including maps.

Positioning Data

Coordinates of the current location of the user can be obtained either by using GPS devices or through cellular operators providing location based services using radiolocation or trilateration. Assisted GPS can also be used in urban areas where in cellular networks help the on-device GPS if the device is out of line of sight of the GPS satellites. In case of LBS provided by cellular operators, the operator may provide APIs to query for the coordinates of a particular subscriber.

You could use a bluetooth GPS device to hook up your cellphone with and enable mobile applications with location data.

A list of lots of GPS devices with some features listes can be found here.

Most of the GPS devices use the NMEA protocol to communicate. Some sample code to handle NMEA data format can be found here.


Geocoding is the process of tying up the name of a place with its coordinates and providing search functionality. Search can either be to get coordinates by providing location name or be by providing coordinates and finding the nearest known location name. The latter is also called as Reverse Geocoding.

Google and Yahoo also provide geocoding in the latest version of their APIs.

Reverse Geocoding (along with Geocoding) can be done through:

- NAC Geo. The API details can be found here.
- OpenGeocoding
- Geobase
- Stephen's tool uses multiple service providers to provide geocoding and reverse geocoding
- Maporama
- GeoNames provides an application and location database that can be downloaded and used locally.

If you have a database of location names tagged with latitude and longitudes, you could build your own geocoding APIs. You'll need a search engine like Lucene and knowledge of the maths behind latitude and longitude (check the first section of this entry). Some information on doing this with SQL is here.

A list of coordinates of Indian cities is here. This will give you a coarse geocoder. Tageo has a directory or more than 2.5 million cities across the world.

Yellow Pages

Finally you need a yellow page database with list of addresses of businesses tagged with coordinates. It may not be easy to find a good freely accessible database of location tagged yellow pages.

Some existing solutions are:
- MSN Yellow Pages
- Yahoo Yellow Pages
- Yellow

Further Study And Useful Links

- Amaze GPS - GPS based navigation
- MLBS Driving Directions and Yellow Pages
- MapQuest
- NavTeq
- Here is a comprehensive list of software
- Microsoft Live Search
- Google Maps Professional Help
- Oracle Map Server
- Directions Mag - Industry Articles

No comments: