0

I'm new using the API Google Maps tool and I'm trying to make an image of car trip around the map, but I can not make that rotation, the parameter rotation only works when I use an own marcagor tool but when put the image in "url: imagen.png" no achievement that this move, then put the different codes that I have tried to use based on what I've found and until now none work I wish I could support please. Thanks and regards.

     1.- 
     var image = {
     url: 'camion.png',
     rotation:22, //Doesn't work
     origin: new google.maps.Point(0, 0),
     anchor: new google.maps.Point(0, 0),
      };

      for (var i = 0; i < camiones.length; i++) {
      var camionT = camiones[i];
      marker = new google.maps.Marker({
      position: {lat: camionT[1], lng: camionT[2]},
      map: map,
      icon: image,
      shape: shape,
      title: camionT[0],
      zIndex: camionT[3],
      rotation:23
  }); 


     2.-
     for (var i = 0; i < camiones.length; i++) {
     var camionT = camiones[i];
     marker = new google.maps.Marker({
     position: {lat: camionT[1], lng: camionT[2]},
     map: map,
      icon: { 
                path: google.maps.SymbolPath.FORWARD_OPEN_ARROW,
                scale: 2,
                rotation: 27// It work but I need the url

                }
     shape: shape,
     title: camionT[0],
     zIndex: camionT[3],
     rotation:23
   }); 


     3.-
     for (var i = 0; i < camiones.length; i++) {
     var camionT = camiones[i];
     marker = new google.maps.Marker({
     position: {lat: camionT[1], lng: camionT[2]},
     map: map,
      icon: { 
                url:'imagen.png',
                scale: 2,
                rotation: 27// Doesn't work

                }
     shape: shape,
     title: camionT[0],
     zIndex: camionT[3],
     rotation:23
   }); 
  • If you really want to use a .png image rather than SVG, you can create an "HTML" marker and rotate the image in it using CSS (jQuery would make it somewhat easier, if you are open to it), or create images rotated ever 5-10 degrees and switch between them. – geocodezip Oct 26 '16 at 17:23
  • PNG and need to use the existing options are not me, one rotates the image but the short and the other does not support the PNG image. Please help. regards! – Diana PG Oct 27 '16 at 16:55
  • Thank! In http://stackoverflow.com/questions/23149613/change-google-map-marker-orientation-according-path-direction I copied the code as it is and I do not see the cart traveling only points A and B. – Diana PG Nov 04 '16 at 00:07
  • Does the code snippet in that question work for you? If so, then your "copy" is missing something. – geocodezip Nov 04 '16 at 00:09
  • If identical copy in css, html and javascript – Diana PG Nov 04 '16 at 00:31

0 Answers0