Solved

google latitude and displaying it in realtime HTML

Posted on 2012-04-11
12
381 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:jonathanduane2010
Comment Utility
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
Comment Utility
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
Comment Utility
i want to display it, is that possible?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 19

Accepted Solution

by:
Bardobrave earned 390 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:jonathanduane2010
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now