function createMarker(latlng, item) {
var marker = new google.maps.Marker({
position: latlng,
map: map
});
This part of the code . On the website it appears as a standard marker, it suits us all but red. How do I change it to another color?
https://yadi.sk/i/ZDONpfoijAjdZ
Create an HTML file which loads Google Maps by following Google Maps API official docs: Hello World. Your code will look something like the code snippet below. Note: Remember to change YOUR_API_KEY to your actual Google Maps API key. 2. Add different color markers To add a blue color marker, we need to change the icon of the marker.
Whether the topic is about the Olympics or has a Valentine’s Day theme, you can be sure you continue your map’s cohesive narrative by customizing the Google Maps icon, also known as the map marker, that symbolizes the locations below. This can be done in three ways, via the color, shape, and label of your map marker.
To the right of the Advanced options menu, next to “Label each marker” choose between none, letters, and numbers. Once you’ve selected, opt to Map Your Data near the bottom of the page. Master the three ways of making your map markers match your content: color, shape, and label with BatchGeo.
Add different color markers To add a blue color marker, we need to change the icon of the marker. This is done by adding an icon property and specifying a URL for it like below.
You should use the icon
property. For example,
var marker = new google.maps.Marker({
position: latlng,
map: map,
icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'
});
There are many colors available at google.com. Just replace green-dot
with your color, like:
http://maps.google.com/mapfiles/ms/icons/green-dot.png
http://maps.google.com/mapfiles/ms/icons/blue-dot.png
http://maps.google.com/mapfiles/ms/icons/red-dot.png
http://maps.google.com/mapfiles/ms/icons/yellow-dot.png
(to get image URL, hover over it or Right-click → 'Copy Image Location' etc)
More at: https://sites.google.com/site/gmapsdevelopment/ or search for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With