Search code examples
javascriptgoogle-maps-api-3trackingfleetdb

Best practices for fleet tracking using google maps v3?


I want to develop fleet tracking app using HTML5,JavaScript, Couch DB for a construction site.I ll get live lat,long of moving vehicles in json format.I dont want to use Direction Services of google since lat,long coming from our own GPS devices.I ll display vehicles as markers.how can i do this in a best way regarding following issues:

  1. Performance
  2. Do i need to maintain separate instance for each vehicle(if 100 vehicles are moving).
  3. Low network speed(since construction sites locates in forest).

Please give me suggestions I ve searched in NET for 1 week but dint get anything useful. Note:I am well aware of google terms and conditions for business.


Solution

  • Google maps api encourages you to use ajax which addresses performance and reduced network loads itself. If you make all the markers identical, you'll reduce the number of images that must load, but your client will not be able to distinguish the vehicles from one another. Therefore, when the locations are updated, you won't be able to tell which vehicles moved where, it'll just be a bunch of markers that randomly move. In my app, I draw marker images on the client side via canvas. This eliminates the network latency of waiting on marker images to load. I have maps where 100 different icons, each with different numbers(labels), load seemingly immediately. Another performance improvement would be to use websockets to send the updated data. You could set up an algorithm on the server side that detects movement of the vehicles and only sends data messages for vehicles that have moved. If each vehicle is given an ID in your JSON feed, you can loop through your markers(vehicles) and update the locations based on matching IDs.