Solved

google latitude and displaying it in realtime HTML

Posted on 2012-04-11
12
384 Views
Last Modified: 2012-06-27
Hi,

I am in the process of setting up google latitude to track a project across europe and at the moment i have it setup to go to www.mightyavonradio.com/football/google.html and at the moment i am importing the KML files but i would love to do it in real time.

Apparently there is a way using REST but i dont know where to start?
0
Comment
Question by:jonathanduane2010
  • 6
  • 6
12 Comments
 
LVL 19

Expert Comment

by:Bardobrave
ID: 37832349
I'm not very sure what do you refer with google latitude.

If you mean the latitude and longitude values of any point in the google maps you can get it through their google maps API, as those are data stored on API classes. You can ask for a determinate point in the maps through petitions to their API, but this won't be realtime, as you'll always have a delay between your request and the server response.

Maybe more info on what you are seeking to achieve could help us to guide you.
0
 

Author Comment

by:jonathanduane2010
ID: 37836529
well at the moment i have the html code to display where a user is and we can embed that to our site but apparently there is a way you you can have location history showing without  having to update using KML files

here is the guide but i cant really follow it

http://code.google.com/apis/latitude/v1/getting_started.html
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 37836866
Didn't know that Google have such an API for positioning.

At first glance the documentation seems clear and complete. Although I still believe you won't receive "real time" info as you should count on a delay between your requests to REST server and their responses, I think it should be fair easy to build a function to stablish a dialog between Latitude API and your app.

Can you explain your exact problem? If the problem is that you are not familiar with REST I think all the info you need to start is on the link you've previously posted. Google's documentation usually is pretty clear.

If you find some rock on your path, ask it here and we'll try to help you moving it away.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:jonathanduane2010
ID: 37851498
Thanks a million for getting back to me,

So i have the code

<!-- Google Public Location Badge -->
<iframe src="http://www.google.com/latitude/apps/badge/api?user=-116452991543013806&type=iframe&maptype=roadmap" width="580" height="400" frameborder="0"></iframe>
<!-- To disable location sharing, you *must* visit https://www.google.com/latitude/apps/badge and disable the Google Public Location badge. Removing this code snippet is not enough! -->
<?xml version="1.0" encoding="UTF-8"?>

so i was wondering to display the location history do i put in

GET https://www.googleapis.com/latitude/v1/location?key=INSERT-YOUR-KEY

and if so where do i put it?
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 37851689
That snippet seems to collect data somehow on your site. But I'm not sure what do you want to do with it?
0
 

Author Comment

by:jonathanduane2010
ID: 37851698
i want to display it, is that possible?
0
 
LVL 19

Accepted Solution

by:
Bardobrave earned 390 total points
ID: 37853253
Well... if you make an AJAX call to

https://www.googleapis.com/latitude/v1/location?key=INSERT-YOUR-KEY

I supose that it will return something to you, then is up to you what do you do with that response. You can show it embeded on any container on your page or extract any info from it (I supose it will response a JSON object, so you should be able to get any specific info).

Just make the call on your client code and manage the return of the request to insert it where you want to show it.
0
 

Author Comment

by:jonathanduane2010
ID: 37853598
how do i make an AJAX call to it?? and can i display it on a HTML page?
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 37854472
If you are using jQuery make an AJAX call is as easy as:

$.ajax({ async: false,
    url: "https://www.googleapis.com/latitude/v1/location?key=INSERT-YOUR-KEY",
    success: function (variableThatWillStoreTheResponse) {
       //Here you can put code to display the result where you want to
    }
});

If you are not using jQuery... well... you should do it. It's probably the best javascript framework out there. Easy, powerful and well documented. Take a look at it:

www.jquery.com
0
 

Author Comment

by:jonathanduane2010
ID: 37855062
0
 

Author Comment

by:jonathanduane2010
ID: 37855068
and do i put it before the html code? and in this line

//Here you can put code to display the result where you want to
    }

do i put in the web address? as i wherever i have the page hosted?
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 37855400
Let's see... I think we have here some type of misunderstanding.

As far as I'm understanding your question:

You want to ask to a google's server for some info. This info is located at a RESTful service accesible by this url: https://www.googleapis.com/latitude/v1/location?key=INSERT-YOUR-KEY

If you paste that url into your web browser you should be able to see the response that google's server return to you.

By making the AJAX call what you do is to call that url from within your page without redirecting your browser to it, and store the response (whatever you've seen when you've pasted it on your browsers url bar) in a javascript variable (if it's a JSON response, which it'll probably be you will be able to load it into a javascript object).

You also want (as far as I'm understanding you) to load that response info (or a part of it) into your webpage.

To do so what you have to do is to use your javascript code to load the info you want to show from the responsed object into the container you want into your page.

Do you understand what I'm trying to state?
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question