Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real time Google Map

Hello Google map API experts, What would be the best(good) way to develop a real time dynamic map using Google Map API.

Example: http://whrrl.com/

It would be really helpful if someone points me towards the right direction. Thank you

like image 306
Ender Wiggin Avatar asked Aug 23 '10 08:08

Ender Wiggin


People also ask

Can you see people in real time on Google Maps?

If you and your close contacts use Google Maps, you might want to use the app's location sharing feature. Using this optional tool, friends, co-workers and family can share their location with each other and see their locations on the map in real-time.

Is there a real time live map?

1. NASA Worldview. NASA's Worldview is a real-time satellite map that is available online. It shows satellite imagery, real-time cloud cover, and 800+ layers of the world.


2 Answers

Just to add another example for you to check out, here is the source code for a live map showing the position of trains on the London Underground. The site can be found at http://traintimes.org.uk:81/map/tube/?from=map;to=tube, although unfortunately it is no longer active as Transport for London has suspended their API service due to high demand. Hopefully you might be able to get an idea from the source code though about how to develop a dynamic, real-time map.

like image 53
Budgie Avatar answered Oct 16 '22 17:10

Budgie


Best place to start is the Google Maps Javascript API. Here is the documentation.

You will find lots of sample there, but basically with a few lines of javascript you can associate a Google Maps object with an element in the DOM (map_canvas):

var latlng = new google.maps.LatLng(-34.397, 150.644);

var myOptions = {
  zoom: 8,
  center: latlng,
  mapTypeId: google.maps.MapTypeId.ROADMAP
};

var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

Having a look at what Whrrl is doing specifically. They are updating their map center (and displaying a custom popup) based on a pre-rendered set of users in the their system (If you view the source for their home page, you can see the big chunk of user JSON at the bottom of the file). This javascript fires events on a timer panning the map from one location to the next.

like image 35
RedBlueThing Avatar answered Oct 16 '22 15:10

RedBlueThing