You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I did some testing regarding this issue. Following the instructions in the migration link did not work as straight forward at it is supposed to. Problems or differences I found:
1- To use AdvancedMarkers it is required to define a mapId
2- AdvancedMarkers library needs to be load from within an async function when needed or add the '&libraries=marker' parameter to the API url
Then, found this blogpost that mentions that an Advanced Markers Utility Library for JavaScript developers was also released, and can be use to define Advanced Markers. The web component will need to add the import import {Marker} from '@googlemaps/adv-markers-utils'; and the 2 points mentioned above are needed as well.
Tested both approachs and they both make the demos using markers to break in different ways. For example, icons or colors are not being taken into consideration, clustering does not work (the version of markerclusterer library need to be updated to a newer version to support AdvancedMarkers), there's a setMap method that doesn't seem valid anymore. Logic on how markers are added will need to be reviewed and updated if the migration takes place.
Decision: add Advanced Markers as a separate element, keep the legacy marker
After re-analyzing this issue, the plan is:
1. Both marker types will coexist. google-map-marker (legacy google.maps.Marker) stays as is. A new element, google-map-advanced-marker (AdvancedMarkerElement), is added alongside it.
Why not replace the legacy marker? AdvancedMarkerElement is not a drop-in replacement:
It requires a mapId, and with a mapId the map's styles property no longer applies (cloud-based styling is used instead).
icon (URL/Symbol), label, animation, optimized and the marker mouse* events have no direct equivalent.
Replacing the element would break the web component API and the Java API (GoogleMapMarker#setIcon, etc.), so it would need a major version.
Users can migrate at their own pace; the legacy marker keeps working (the deprecation warning is Google's, not ours, and not a removal).
2. The goal is feature parity.
Everything the legacy marker can do should be achievable with the advanced one. Where there is no native equivalent it will be emulated (e.g. icon URL → <img> content, animation → CSS, mouse events → DOM listeners on the content), or documented as not applicable (optimized).
3. Delivered in small PRs to ease review.
Core element (position, pin/content, click/drag events, info window, fit-to-markers, clear())
Clustering / google-map.js integration
Parity with the legacy marker (icon, label, animation, mouse events, touch-and-hold)
Java wrapper in this repo (GoogleMapAdvancedMarker)
Open points to verify in a spike: loading the marker library (the bundled loader does not request it, so likely importLibrary('marker')), and marker clustering with the current @googlemaps/markerclusterer.
The previous draft PR (FlowingCode/google-map#48) has been closed in favor of this incremental approach.
Activity
paodb commentedon Apr 22, 2024
I did some testing regarding this issue. Following the instructions in the migration link did not work as straight forward at it is supposed to. Problems or differences I found:
1- To use AdvancedMarkers it is required to define a mapId
2- AdvancedMarkers library needs to be load from within an async function when needed or add the '&libraries=marker' parameter to the API url
Then, found this blogpost that mentions that an Advanced Markers Utility Library for JavaScript developers was also released, and can be use to define Advanced Markers. The web component will need to add the import
import {Marker} from '@googlemaps/adv-markers-utils';and the 2 points mentioned above are needed as well.Tested both approachs and they both make the demos using markers to break in different ways. For example, icons or colors are not being taken into consideration, clustering does not work (the version of markerclusterer library need to be updated to a newer version to support AdvancedMarkers), there's a setMap method that doesn't seem valid anymore. Logic on how markers are added will need to be reviewed and updated if the migration takes place.
paodb commentedon Oct 2, 2026
Decision: add Advanced Markers as a separate element, keep the legacy marker
After re-analyzing this issue, the plan is:
1. Both marker types will coexist.
google-map-marker(legacygoogle.maps.Marker) stays as is. A new element,google-map-advanced-marker(AdvancedMarkerElement), is added alongside it.Why not replace the legacy marker?
AdvancedMarkerElementis not a drop-in replacement:mapId, and with amapIdthe map'sstylesproperty no longer applies (cloud-based styling is used instead).icon(URL/Symbol),label,animation,optimizedand the markermouse*events have no direct equivalent.GoogleMapMarker#setIcon, etc.), so it would need a major version.Users can migrate at their own pace; the legacy marker keeps working (the deprecation warning is Google's, not ours, and not a removal).
2. The goal is feature parity.
Everything the legacy marker can do should be achievable with the advanced one. Where there is no native equivalent it will be emulated (e.g. icon URL →
<img>content, animation → CSS, mouse events → DOM listeners on the content), or documented as not applicable (optimized).3. Delivered in small PRs to ease review.
clear())google-map.jsintegrationGoogleMapAdvancedMarker)Open points to verify in a spike: loading the
markerlibrary (the bundled loader does not request it, so likelyimportLibrary('marker')), and marker clustering with the current@googlemaps/markerclusterer.The previous draft PR (FlowingCode/google-map#48) has been closed in favor of this incremental approach.
feat: load marker library
feat: load marker library
feat: add GoogleMapAdvancedMarker
feat: add GoogleMapAdvancedMarker
feat: add GoogleMapAdvancedMarker