954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

route lines on google map

Hi frendz,
In my vehicle tracking project, I need to draw the route (polyline) of my vehicle in google map. When the vehicle is moving away from that route, it should give alert msg.
So how to specify the route line on google map?

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

Have you had a look at the Google Maps API?

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 
Have you had a look at the Google Maps API?


Yes Ardav, I used the google map API through out project. I got the code only to draw the polylines with set of latitude and longitude points. But I need to track whether the vehicle is moving on that line or not. Now i'm searching for that only.

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

how to generate latitude and longitude points by drawing lines on google map using javascript?

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

How are you receiving the vehicle's data? Which format?

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 
How are you receiving the vehicle's data? Which format?

latitude and longitude points as seperate column in database like this. <strong>latitude </strong> <strong>Longitude</strong>
11.027847 77.007263
11.027687 77.006943
11.025792 77.006935

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

Can't you add and remove points via the API? However, I don't think it will change in real time, otherwise you'd have to Ajax the DB/ Map container every 30s or so.

My take:
If you can store the data automatically.
On page load, get the latest DB lat/long and then load the map with only the latest point and the route.
Is that what you want/need. Can you do it?

If you're using V.3:

var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  var myOptions = {
    zoom: 4,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
  var marker = new google.maps.Marker({
      position: myLatlng, 
      map: map, 
      title:"Hello World!"
  });


from the API documentation.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Can't you add and remove points via the API? However, I don't think it will change in real time, otherwise you'd have to Ajax the DB/ Map container every 30s or so.

My take: If you can store the data automatically. On page load, get the latest DB lat/long and then load the map with only the latest point and the route. Is that what you want/need. Can you do it?

If you're using V.3:

var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  var myOptions = {
    zoom: 4,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
  var marker = new google.maps.Marker({
      position: myLatlng, 
      map: map, 
      title:"Hello World!"
  });

from the API documentation.

Thanks for your effort Ardav. I'll try this.

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: