Monday 26 November 2012

Integrating Google Places API with Wiki Services

Google Places API, Wikitravel & Wikipedia

As you might already know Google Places API is an extremely powerful mechanism to locate the important attractions on earth. If you have not used Google Places API before please go to the Google documentation which is a good place to start  

This API allows you to retrieve all the attractions pertaining to a particular place on earth. Below are some of  attraction types returned by Google APIs per place:  amusement_park , aquarium , art_gallery ,church ,museum , zoo etc


If you are planning to write a tour travel/trip planning application , then using Google APIs would be a natural choice to automatically retrieve all the tourist attractions available at the tour destination. But the challenge here is that we need a very good description of the tourist attraction which is not directly available in search response. From a user standpoint the search is not complete if it does not include additional details related to that attraction. The question is how do we make the search results more user friendly by associating them to an authentic source of information? I faced this challenge myself while writing a travel app and this is how I solved it ...


If you have used Wikipedia ever you would not deny that it is the most trusted source of information for anything in internet. I made an attempt to integrate Google Places API response with Wiki pages.  Below are the two things I wanted to achieve out of this integration


1. When someone is searching a tour destination automatically display a hyper link to the travel guide to that destination from wikitravel

2.For each search result part of Google Places API response display a hyperlink it to the corresponding Wiki page related to that attraction from wikipedia

You can see a live example which I have written: My TripChatBox Planner


This simple integration was possible because I could observe an interesting naming convention followed by the Wiki pages & Google.

1.Automatically Populate Travel Guide Link

Let us assume a customer is searching for Los Angeles in the above trip planner.
It would useful if we are able to guide the user with a travel guide to Los Angeles.

All we need to do to get a travel guide to this place is to generate a URL pointing Wikitravel website.


  • Here the place name is : Los Angeles
  • Now replace the spaces in the place name with underscore : Los_Angeles
  • Append this to the wikitravel URL as below 

Desktop URL

http://wikitravel.org/en/Los_Angeles

Mobile URL

If you want the travel guide in mobile then you need to construct a URL like

http://m.wikitravel.org/en/Los_Angeles

If the place name does not have a space then its more easy , simply append the place name to wikitravel URL

Desktop URL

http://wikitravel.org/en/London

Mobile URL


http://m.wikitravel.org/en/London


2. Automatically populate a Wiki Link to a tourist attraction

The same approach of replacing spaces with underscore character holds good for displaying a Wiki page associated with an attraction part of Google Places API search response - the only difference is that we point to Wikipedia rather than wikitravel 

For example you will get Westminster Cathedral as one of the attraction as part of the attraction search results associated with London from Google Places API. In order to get a wiki page associated with this attraction simply follow the principle above. 

Two example URLs below

Desktop URL


http://en.wikipedia.org/wiki/Westminster_Cathedral


Mobile URL


http://en.m.wikipedia.org/wiki/Westminster_Cathedral


This integration was possible because the naming conventions followed for  attractions between Wiki and Google Places are matching !!


I hope my article helps you to quickly link two powerful sources of information on earth : Google Places API and Wiki.


If you are interested on a step-by-step tutorial  please refer my blog Developing a travel planning app with Google places , Wiki and Panoramio API.

What I have given above is a short-cut , but there are other ways as well to get useful information regarding places. Some references below


1. The Geolocation API for WikiPedia


2. WikiSherpa API

References :
Next >>: Developing a travel planning app with Google places , Wiki and Panoramio API.

4 comments:

  1. http://zodiacaffinity.blogspot.co.uk/

    Affinity is a unique facebook application for sun sign(zodiac sign) compatibility check(affinity match) between you & friends. It allows people to compare sun sign predictions with real word evidence. It's capability for endorsing/badging people's qualities makes it unique from other applications. Affinity is the first application of its kind designed to seek the real truth behind sun signs by allowing people to match sun sign predictions with ratings from friends.

    ReplyDelete
  2. My new blog :

    A practical guide to measuring IT services based on business outcomes. This is a step by step approach to move towards business outcomes based model while delivering IT services to a customer. It explains how to report IT systems based on the business outcomes they deliver and the benefits of this model.

    http://tweetsnippets.blogspot.co.uk/2014/05/practical-guide-to-measuring-it.html

    ReplyDelete