πŸ“ Advanced Markers

Spatialized founder Jozef Sorocin
Book a consultation β†—
27 min read  β€’  Updated 06/19/2026

What You'll Master in This Chapter

  • 4 Approaches: Image URLs, encoded SVGs, AdvancedMarkerElement (HTML/CSS), and WebGL via deck.gl
  • Framework Integration: React/Vue/Angular examples with TypeScript
  • Troubleshooting: Debug common AdvancedMarkerElement issues and performance bottlenecks
  • Performance: Techniques used by mapping applications like Airbnb and Uber

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.

2026 Update: Several API changes since this chapter was last updated:

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 350+ developers who've mastered this!
Already a member? Sign in here