Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
161
rated 0 times [  163] [ 2]  / answers: 1 / hits: 16805  / 9 Years ago, mon, january 18, 2016, 12:00:00

I would like to add 2 circles(red and green) instead of the default marker on the google maps. I need the color of the circles to change(increase/decrease of intensity) based on the values in the database. Is it possible to do so?


More From » google-maps

 Answers
48

Create a circle as a marker icon, for example:



var oMarker = new google.maps.Marker({
position: latLng,
sName: Marker Name,
map: map,
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 8.5,
fillColor: #F00,
fillOpacity: 0.4,
strokeWeight: 0.4
},
});


and then, if you want to change the marker dynamically (like on mouseover), you can, for example:



oMarker.setIcon({
path: google.maps.SymbolPath.CIRCLE,
scale: 10,
fillColor: #0F0,
fillOpacity: 0.8,
strokeWeight: 1
})

[#63675] Saturday, January 16, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rohan

Total Points: 403
Total Questions: 93
Total Answers: 105

Location: Trinidad and Tobago
Member since Mon, Jul 13, 2020
4 Years ago
;