Solved

google latitude and displaying it in realtime HTML

Posted on 2012-04-11
12
385 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

809 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