angularionic-frameworkangular-maps

@angular/google-maps 13.3.9 - Make marker have round shape and image


I need to add a custom marker into my map. All I want is for it to have a circle shape and an image inside, but I can't get it to work. Code:

    <div class="map-container">
  <google-map width="100%" height="100%" [center]="center" [zoom]="zoom">
    <map-marker
      *ngFor="let marker of markers"
      [position]="marker.position"
      [options]="marker.options"
      [title]="marker.title"
    ></map-marker>
  </google-map>
</div>

And how I fill the markers:

this.markers.push({
        position: { lat: parseFloat(lat), lng: parseFloat(lon) },
        title: nombre,
        icon: {
          url: restaurant.imagenes[0]?.ruta_imagen,
          scaledSize: new google.maps.Size(size, size),
        } as google.maps.Icon,
        options: {
          draggable: false,
          shape: {
            coords: [size / 2, size / 2, size / 2],
            type: 'circle',
          },
        } as google.maps.MarkerOptions,
      });

As much as I try variations, all I get is a squared image. Can someone help? Thanks!


Solution

  • I did some digging and, using the angular-maps, you have no way to display a round image unless the image is already round.

    Best I could get was using a custom SVG.