Meena Narayanan
Meena Narayanan

Reputation: 79

How to set car icon in google map using jquery

Is it is any possible to set custom car icon in google map without use image format like car.png, car.jpg etc. Because rotation problem is coming. so I want only icon type (SVG), like below this

var car = "M17.402,0H5.643C2.526,0,0,3.467,0,6.584v34.804c0,3.116,2.526,5.644,5.643,5.644h11.759c3.116,0,5.644-2.527,5.644-5.644 V6.584C23.044,3.467,20.518,0,17.402,0z M22.057,14.188v11.665l-2.729,0.351v-4.806L22.057,14.188z M20.625,10.773 c-1.016,3.9-2.219,8.51-2.219,8.51H4.638l-2.222-8.51C2.417,10.773,11.3,7.755,20.625,10.773z M3.748,21.713v4.492l-2.73-0.349 V14.502L3.748,21.713z M1.018,37.938V27.579l2.73,0.343v8.196L1.018,37.938z M2.575,40.882l2.218-3.336h13.771l2.219,3.336H2.575z M19.328,35.805v-7.872l2.729-0.355v10.048L19.328,35.805z";
var icon = {
  path: car,
  scale: .7,
  strokeColor: 'white',
  strokeWeight: .10,
  fillOpacity: 1,
  fillColor: '#404040',
  offset: '5%',
  // rotation: parseInt(heading[i]),
  anchor: new google.maps.Point(10, 25) // orig 10,50 back of car, 10,0 front of car, 10,25 center of car
};

Above type car is ok. But I want to use images/carnew.svg image for the icon, IS its any way?

Upvotes: 0

Views: 3419

Answers (1)

Abdul Aziz
Abdul Aziz

Reputation: 11

var image="https://example.com/images/carnew.svg";

var marker = new google.maps.Marker({
    position: uluru,
    icon: image,
    map: map
});

The image that you mention will be displayed as a marker.

Upvotes: 1

Related Questions