When I click an item from the drop-down list, it displays them on the map.
I need him to also draw a poly line from my current location on each graph (coordinates on the map).
EDIT:
When i use:
var myTrip = [{lat: -26.077740, lng: 28.010100} ,
latlng];
it draws poly lines from this location to all the graphics, but if I try to get it to draw from my current location, which comes from "mylatlng", it does not work.
How to make mylatlng work and make it from my current location instead of hard-coding the value from which the poly line starts?
var mylatlng = new google.maps.LatLng(lat, lng);
var myTrip = [mylatlng,
latlng];
var flightPath = new google.maps.Polyline({
path: myTrip,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
The current location works for everything I use for it, with the exception of the polyline. Here's the declaration:
$(document).ready(function () {
var geocoder;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(successFunction,
errorFunction);
}
function successFunction(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
codeLatLng(lat, lng)
}
function errorFunction() {
alert("Geocoder failed");
}
function codeLatLng(lat, lng)
{
}
, latlng , , myLatLng, .