0

Of course, I make code for marker add and move, but how do I can make deletion option for marker? And how do I can make automatic route creator from marked point A to marked point B? Anyone know?

var riga = new google.maps.LatLng(56.878999, 24.455566);

  var neighborhoods = [
    new google.maps.LatLng(56.946250, 24.104494)
  ];

  var markers = [];
  var markersArray = [];
  var map;

  function initialize() {
    var mapOptions = {
      	zoom: 7,
      	mapTypeId: google.maps.MapTypeId.HYBRID,
      	center: riga
    };

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

  google.maps.event.addListener(map, 'click', function(event) {
    addMarker(event.latLng);
  });
}
  
function addMarker(location) {
  marker = new google.maps.Marker({
    position: location,
    map: map,
	draggable: true,
    animation: google.maps.Animation.DROP
  });
  markersArray.push(marker);
}
2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by Airshow
0

Mcwebalizer,

marker.setMap(null);

marker still exists in javascript but is no loner displayed.

To redisplay marker on myMap :

marker.setMap(myMap);

Airshow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.