Geolocation is cool

I have been fiddling with geolocation technology for the past few days.Seems that this technology has been adopted by many famous sites.

Geolocation aware sites

Foursquare is a famous geolocation media where we can ‘check in’ to places on the map. It got so popular until some coffee vendor offer discounts when you checked in to their shop in foursquare.

Twitter is publishing an API that will allow developers to pinpoint a tweet coordinate on the map. Developer can create application that allow twitter user to understand what people have been tweeting about nearby public events or place of interest. Imagine that where you can create a twitter application that scans for information about your location, for example: imagine if you tweet @eventsnearme and the twitter application reply your tweet by listing any events that are happening near you.

Geolocation aware web browser

Mozilla Firefox has incorporated Geolocation standard in their browser since 3.5 beta 4. Developer can ask Firefox user about their location only by incorporating this very simple code:

<html>
<head>
<script type="text/javascript">

function displayLocation(loc) {
  var locDiv = document.getElementById("locationDiv");
  locDiv.innerHTML = "lat: " + loc.coords.latitude + ", lon:" + loc.coords.longitude;
}

function getLocation() {
    navigator.geolocation.getCurrentPosition(displayLocation);
}

</script>
</head>

<body>
<a href="#" onClick="getLocation()">Click here to display location</a><br>
<div id="locationDiv"></div>
</body>
</html>

Google has some pretty nifty geolocation technology that enable developers to securely access user location on the map using java script. First there is the google.loader.ClientLocation ajax API that gives an approximate location of the user. Getting a user coordinate is as easy as:

var userLocation = google.loader.ClientLocation;
alert("User latitude coordinate : " + latitude);
alert("User longitude coordinate : "+ longitude);

There is also the Google Gears geolocation API that can detect nearby cell towers. Gears is an open source browser extension that lets developers create web applications that can run offline. Gears provides three key features:

  • A local server, to cache and serve application resources (HTML, JavaScript, images, etc.) without needing to contact a server,
  • A database, to store and access data from within the browser,
  • A worker thread pool, to make web applications more responsive by performing expensive operations in the background

Developers can access user location through gear api with a very simple java script code:


var geo = google.gears.factory.create('beta.geolocation');
 geo.getCurrentPosition(function(position){

alert("User latitude  :" + position.latitude);

alert("User longitude:" + position.longitude);

}, function(error){});

Google Maps for the mobile version seem to be able to pinpoin user approximate location although their cell phone does not have a GPS chip. A mobile phone knows the cell tower id where it receives and sends signal. Google Maps for mobile API uses this cell id to obtain an approximate coordinate of the mobile user.

Locate for me

I created website where that uses Google Gear API to detect user location and allow users to search for nearby place of interest. It uses Google Maps, Google Gear, and Google Search AJAX API. Google Gears is still under developer release and is not meant to be used for production. Some of its API are still pretty unstable, and may give different result in different firefox version.

I hosted this website at google app engine.At the moment in only provides basic feature like detecting where you are and allowing user to search for nearby places. I would like to be able to pull out what people has been saying about a particular place through four square or twitter.

Share

Advertisements

About zainul franciscus

Hi, I am a software developer and tech blogger who is currently living in Wellington, New Zealand. I write stuff that I find interesting on
This entry was posted in locate-for-me, programming, social media, web development and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s