vue3-google-map icon indicating copy to clipboard operation
vue3-google-map copied to clipboard

Add support for AdvancedMarker

Open halvtomat opened this issue 1 year ago • 5 comments

The google maps Marker element is deprecated as of February 2023, Advanced marker is the new better version.

Read more about Advanced marker here

halvtomat avatar Feb 22 '24 07:02 halvtomat

Thanks for the heads up! We'll try and work that into our plans.

HusamElbashir avatar Feb 22 '24 14:02 HusamElbashir

Screenshot 2024-03-07 at 11 33 37

For more details

ScreamZ avatar Mar 07 '24 10:03 ScreamZ

I was able to use the AdvancedMarkerElement by adding marker to the libraries prop.

<GoogleMap :libraries="['marker']" ...

Once I did that, I was able to add the marker as follows (see the Advanced Usage section).

const marker = new this.refMap.api.marker.AdvancedMarkerElement({
  map: this.refMap.map,
  position: {
    lat: -25.363,
    lng: 131.044,
  },
});

@HusamElbashir marker should be added to the list of libraries to avoid any TypeScript warnings...

libraries: {
  type: Array as PropType<("drawing" | "geometry" | "localContext" | "places" | "visualization" | "marker")[]>,
  default: () => ["places"],
},

Thank you for putting the component together!

Molanda avatar May 03 '24 01:05 Molanda

I was able to use the AdvancedMarkerElement by adding marker to the libraries prop.

<GoogleMap :libraries="['marker']" ...

Once I did that, I was able to add the marker as follows (see the Advanced Usage section).

const marker = new this.refMap.api.marker.AdvancedMarkerElement({
  map: this.refMap.map,
  position: {
    lat: -25.363,
    lng: 131.044,
  },
});

@HusamElbashir marker should be added to the list of libraries to avoid any TypeScript warnings...

libraries: {
  type: Array as PropType<("drawing" | "geometry" | "localContext" | "places" | "visualization" | "marker")[]>,
  default: () => ["places"],
},

Thank you for putting the component together!

Could you please show us the full example how you solve it ?

Thanks in advance.

allaghi avatar May 15 '24 09:05 allaghi

I was able to use the AdvancedMarkerElement by adding marker to the libraries prop.

<GoogleMap :libraries="['marker']" ...

Once I did that, I was able to add the marker as follows (see the Advanced Usage section).

const marker = new this.refMap.api.marker.AdvancedMarkerElement({
  map: this.refMap.map,
  position: {
    lat: -25.363,
    lng: 131.044,
  },
});

@HusamElbashir marker should be added to the list of libraries to avoid any TypeScript warnings...

libraries: {
  type: Array as PropType<("drawing" | "geometry" | "localContext" | "places" | "visualization" | "marker")[]>,
  default: () => ["places"],
},

Thank you for putting the component together!

Hello! How to use it with MarkerCluster component?

oawebdev avatar May 17 '24 11:05 oawebdev

Hello, any update on this new feature? Thank you :)

sbautista05 avatar May 24 '24 18:05 sbautista05

Hello, is there any way to use MarkerCluster with advanced marker?

luisfrancajr avatar May 27 '24 20:05 luisfrancajr

Any updates on this with MarkerCluster?

Indre87 avatar Jul 01 '24 14:07 Indre87

I created a PR to add the new AdvancedMarker component: #263 To be honest the new component doesn't seem to bring any big changes, the only thing I saw different was the option to custumize the pin without actually replacing it by an image, and also removed a lot of events and options that existed in the old component (like the property for animation, which now have to be done by hand). But at least it stops the anoying warnings and can easily replace the Marker component

VictorBalbo avatar Jul 12 '24 19:07 VictorBalbo

Released in v0.21.0. Thanks to @VictorBalbo for the contribution.

HusamElbashir avatar Aug 04 '24 23:08 HusamElbashir