Skip to content

"google.maps.Marker is deprecated" warning #121

Closed

Description

@paodb

Got this message while running the add-on:

image

The mentioned link is https://developers.google.com/maps/documentation/javascript/advanced-markers/migration

This needs to be investigated.

Activity

  1. paodb commented on Apr 22, 2024

    @paodb
    MemberAuthor

    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.

  2. moved this from To Do to In Progress in Flowing Code Addonson Jul 17, 2026
  3. self-assigned this
    on Oct 2, 2026
  4. paodb commented on Oct 2, 2026

    @paodb
    MemberAuthor

    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.

    1. Core element (position, pin/content, click/drag events, info window, fit-to-markers, clear())
    2. Clustering / google-map.js integration
    3. Parity with the legacy marker (icon, label, animation, mouse events, touch-and-hold)
    4. 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.

  5. added 2 commits that reference this issue on Oct 27, 2026
    e3697f6
    679fe68
  6. added a commit that references this issue on Oct 27, 2026
    d9f11f4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions