π‘ Home π Chapter π Prev π Next
β‘Β GMapsBook.com is crafted by Jozef Sorocin (π’Β Book a consulting hour) and powered by:
Youβve got a Google Map set up and want to place markers on it. You donβt want to go with the default, red markers β you want your brand to stand out.
In this step-by-step guide weβll analyze four hands-on approaches and help you understand & implement advanced map markers.
<aside> β‘ Also check out our Google Maps Handbook, esp. the chapters on π Markers, Lines, & Shapes and π·οΈ Custom Marker Labels.
</aside>
Image-based Google Maps marker
Assuming youβve initialized your map:
const myMap = new google.maps.Map({ ... });
you can now create your first custom marker by filling in the icon
property:
const marker = new google.maps.Marker({
map: myMap,
position: {
lat: 48.7277,
lng: 21.2453,
},
icon: {
url: 'https://...',
}
});
Google Maps will now take this image and render it in its original size.
<aside>
π‘ If you need to downsize the image, eg. to 36 Γ 36px, you can use scaledSize
:
const marker = new google.maps.Marker({
...
icon: {
url: '...',
scaledSize: new google.maps.Size(36, 36),
}
});
</aside>