Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  28] [ 5]  / answers: 1 / hits: 63566  / 12 Years ago, sat, november 17, 2012, 12:00:00

How to draw a line between two points (Latitude and Longitude) with the Google map API using jQuery or Javascript? I need the shortest path between the two points. It may be any type of line.


More From » jquery

 Answers
46

For API v2 only!



The following code snippet creates a 10-pixel-wide red polyline between two points:



var polyline = new GPolyline([
new GLatLng(37.4419, -122.1419),
new GLatLng(37.4519, -122.1519)],
#ff0000, 10);
map.addOverlay(polyline);


You can find the documentation here.


[#81940] Thursday, November 15, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jocelynkarsynr

Total Points: 472
Total Questions: 98
Total Answers: 96

Location: Macau
Member since Mon, Nov 16, 2020
4 Years ago
jocelynkarsynr questions
Tue, Feb 8, 22, 00:00, 2 Years ago
Sat, Jul 11, 20, 00:00, 4 Years ago
Sun, May 10, 20, 00:00, 4 Years ago
Sat, Jan 18, 20, 00:00, 4 Years ago
;