πŸ“ Advanced Markers

Spatialized founder Jozef Sorocin
Jozef Soročin
Updated 07/13/2025

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.

Image-based Google Maps marker
Image-based Google Maps marker
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.

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),
    }
});

Depending on your image dimensions and shape, the marker placement may appear off. That's because, by default , β€œthe anchor is located along the center point of the bottom of the image”.

Let's say you don't like this default behavior (left) and you'd want your custom marker fully centered (right):

Anchored around [center, bottom]

Anchored around [center, bottom]

Anchored around [center, bottom]
Anchored around [center, center]

Anchored around [center, center]

Anchored around [center, center]

You can use the anchor property to position the image to your liking:

const marker = new google.maps.Marker({
    ...
    icon: {
      url: '...',
      scaledSize: new google.maps.Size(36, 36),
      anchor: new google.maps.Point(18, 18),
    }
});

Note that Point(0,0) starts top-left and Point(imgWidth,imgHeight)ends bottom-right. To fully center your image, divide its dimensions in half β€” e.g. Point(18, 18) as in the case above.

  • Easy to set up & configure
  • Covers most use cases (store locator, branding, etc)
  • Limited to fixed image assets
  • No dynamic content
  • Risk of improper downsizing and thus pixelation

SVG-generated Google Maps markers
SVG-generated Google Maps markers
SVG-generated Google Maps markers

In Approach #2, it'd be technically possible to pass an SVG url (like this ) to the icon object.

SVGs are great for map use because they're vector-based β€” they scale well and, unlike with JPEGs or PNGs, you'll avoid pixelation.

But SVGs are also notoriously hard to understand. And edit. You'll need a tool like Figma to efficiently customize & export them.

Join 200+ developers who've mastered this! Get Complete Access β€” €19
Already a member? Sign in here