Tuesday, July 23, 2024
Google MapJavascript

How to change the color of marker in google maps?

change the color of marker in google maps

Hello, welcome to In this post, I will tell you How to change the color of marker in google maps? Google is the best search engine and top brand. Google provides us so many api’s and today we will do google map api. I will tell you lot of trick with google map api but today we will discuss how to change the color of google map marker.

Please check the working image:

Here is the working code to change the google map marker:

<div id=”map”></div>
#map {
height: 90%;
width: 100%;
function initAutocomplete() {
var myLatLng = {lat: 30.900965, lng: 75.857276};
var map = new google.maps.Map(document.getElementById(‘map’), {
zoom: 12,
center: myLatLng
var icon = {
path: “M27.648-41.399q0-3.816-2.7-6.516t-6.516-2.7-6.516 2.7-2.7
6.516 2.7 6.516 6.516 2.7
6.516-2.7 2.7-6.516zm9.216 0q0 3.924-1.188 6.444l-13.104 27.864q-.576
1.188-1.71 1.872t-2.43.684-
0-7.632 5.4-13.032t13.032-5.4
13.032 5.4 5.4 13.032z”,
fillOpacity: 1,
strokeWeight: 0,
scale: 0.65
var marker = new
position: myLatLng,
map: map,
icon: icon,
title: ‘Hello World!’
<script src=”
async defer></script>

There are so many tricks in Google map api and i will let you know all. Please do comment if you any query related to this post. Thank you.

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.