How to get directions between two places?

One of the challenges was to get the directions between two places obtained as input from the user.

So we read the Google Directions API provided by the Google Map Web Services. We understood that we needed to get the steps. A step is basically one line of direction, in layman’s terms. So the html_instructions in each step is what we needed.

[php]

$origin=urlencode($_GET[‘origin’]);

$destination=urlencode($_GET[‘destination’]);

//:::::::::::::::: Get the directions from google maps using curl :::::::::::::::::::::

$output="";

$ch= curl_init();

curl_setopt($ch, CURLOPT_URL, "http://maps.googleapis.com/maps/api/directions/json?origin=$origin&destination=$destination&sensor=false");

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch,  CURLOPT_RETURNTRANSFER, true);

$data=curl_exec($ch);

$json_data_var = json_decode($data, true);

//print_r($json_data_var);

[/php]

Lets quickly understand what the above code does? It uses the curl library to send a request to the googleapis in the specified format stores the json response object in the variable named $json_data_var as a array.

An Android tracing App

 

This project is one of my self projects.
The aim was to understand HTTPClient in Android and Asynctask. Also I wanted to publish a app in the android market as I have never done it before.
I was browsing the market and a idea struck me. Can Indian android users, trace the unknown mobile numbers, or vehicle numbers instantaneously if required? I searched the android market  and found that there was no such app which gives you all these functionalities at one place. Without giving it more thought I jumped into developing it. 

I found websites which would give you the response of such queries. Using firebug, I figured out what are is the type of the query and the variables used in the query? After that it was easy. 🙂

Now after developing the core functionality I found that the app also taught me how to implement a Dashboard and its importance. Dashboard is one if the Design patterns suggested by google. Not on ly this, I had never pondered on the design aspects of the android application. As the application was small and simple, I ventured into the styling of the UI. I am still learning the techniques and that is the reason I haven’t been able to oublish it in the market yet.

But very soon!! 🙂

 

 

Enhanced by Zemanta

Birth of Offline Way2Go

The idea was born in Prof. Mangesh Bedekar’s Chamber when he was telling me about the problem of transferring data on the computer screen to mobile or your laptop etc. For example, you use google map and pan your trip! You create way points and different routes etc between two places. Now you want to save it in your mobile or your laptop! how will you do it? The crude way i can think of is saving it as a image by taking the screenshot of your computer screen. 

Then we found out that in USA, this problem has been addressed. The  solution in brief is that you  take a screen shot and save it. Then through image processing the image will be saved a real time data into your device. Here is the link to what i m refering to.But we also found out that, you have barcode and QR code scanning capability in the mobile devices. So we can ecode some data and pass it to the required device.

To our dismay, people had already thought of it and made browser extensions to save a url, text or image url in a qr code and transfer it to your phone. Then we came up with this idea, which we later on named as Offline Way2Go.

It is a chrome extension and a website where you can enter places of your choice and get the directions between them as suggested by google in the form a QR code.This will be useful for those who dont have GPRS or travelling without any kind of internet connection in their phone.
Later we thought of adding a feature in the android app where they can also share the directions to others if they want. Why only a chrome extension? Because it was too easy to make one 🙂
Why an Android app? Because I only know Android programming. If the idea is excepted by users, I ll not hesistate in making Iphone app as well.

Enhanced by Zemanta