Skip to content

feat: add GoogleMapAdvancedMarker - #186

Open
paodb wants to merge 6 commits into
masterfrom
issue-121-advanced-marker
Open

paodb wants to merge 6 commits into
masterfrom
issue-121-advanced-marker

Conversation

@paodb

@paodb paodb commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Adds GoogleMapAdvancedMarker, a marker based on Google's Advanced Markers (AdvancedMarkerElement), the replacement for the deprecated google.maps.Marker used by GoogleMapMarker. As decided in the issue, both kinds of markers coexist and GoogleMapMarker is unchanged.

API

  • Same API as GoogleMapMarker: constructors, position, caption, draggable, icon (URL, MarkerIcon or Symbol), label, info window, and the click, right click (also touch-and-hold on touch devices) and drag end listeners, with their own event classes.
  • New: setPinBackground, setPinBorderColor, setPinGlyphColor and setPinScale to customize the default pin.
  • GoogleMap.addMarker(GoogleMapAdvancedMarker) and GoogleMap.removeMarker(GoogleMapAdvancedMarker).
  • setVisible(false) hides the marker (with GoogleMapMarker it has no effect after the marker is created).
  • Advanced markers can be clustered, like legacy markers.

Not available, as Advanced Markers have no equivalent: animation, optimization, icon sprites, a label together with an icon, and the font and CSS class of a label. Documented in the class.

Map ID
Advanced Markers require the map to have a Map ID (GoogleMap.setMapId(...)). Without it the marker is silently not shown, and a map's Map ID can't be changed once it's created, so an IllegalStateException with a clear message is thrown when the marker is attached to a map without Map ID (or by addMarker, if the map is already shown, without adding the marker).

Dependencies

  • @flowingcode/google-map updated to 3.10.1, which adds google-map-advanced-marker.
  • @googlemaps/markerclusterer updated from 2.0.8 to 2.6.2, the version the web component requires. With it, cluster icons are drawn as advanced markers on maps with a Map ID; maps without a Map ID keep the legacy cluster icons (Marker clustering fails on maps without a Map ID google-map#56). Custom renderers are used unchanged.

Other changes

  • Version bumped to 2.7.0-SNAPSHOT, as this is a new feature (@since 2.7.0 in the new API).
  • commons-demo upgraded to 5.5.0 in the v25 profile: with 5.2.0 the development bundle fails to build when the frontend dependencies change (unresolved lit-element import). Upgrading Vaadin in that profile is left for a separate PR.
  • Demos: Advanced Markers and Advanced Markers Clustering.

Close #121

Summary by CodeRabbit

  • New Features
    • Added support for advanced Google Maps markers, including custom pins, labels, icons, dragging, info windows, and click events.
    • Added marker management and clustering support for advanced markers.
    • Added interactive demos for advanced markers and marker clustering.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 20db9c3d-85fd-4670-8463-11b4c7ec6c40
📥 Commits

Reviewing files that changed from the base of the PR and between a259bd4 and 84ee8c9.

📒 Files selected for processing: 9
  • pom.xml
  • src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMap.java
  • src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapAdvancedMarker.java
  • src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapMarker.java
  • src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoint.java
  • src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java
  • src/test/java/com/flowingcode/vaadin/addons/googlemaps/AdvancedMarkersClusteringDemo.java
  • src/test/java/com/flowingcode/vaadin/addons/googlemaps/AdvancedMarkersDemo.java
  • src/test/java/com/flowingcode/vaadin/addons/googlemaps/GooglemapsDemoView.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The project adds a Vaadin component for Google Maps advanced markers, adds map operations for those markers, updates Google Maps package versions, and adds two demos for advanced markers and clustering.

Changes

Advanced markers

Layer / File(s) Summary
Advanced marker component
src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapAdvancedMarker.java
GoogleMapAdvancedMarker adds marker position, caption, dragging, icon, label, pin styling, and info-window properties. It validates the map ID when attached to a GoogleMap. It provides drag-end, click, and right-click events with coordinates.
Map integration and package versions
src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMap.java, src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapMarker.java, src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoint.java, src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java
GoogleMap adds methods to add and remove advanced markers and update map markers. The map components declare @flowingcode/google-map version 3.10.1 and @googlemaps/markerclusterer version 2.6.2.
Advanced marker demos
src/test/java/com/flowingcode/vaadin/addons/googlemaps/AdvancedMarkersDemo.java, src/test/java/com/flowingcode/vaadin/addons/googlemaps/AdvancedMarkersClusteringDemo.java, src/test/java/com/flowingcode/vaadin/addons/googlemaps/GooglemapsDemoView.java, pom.xml
The demos show advanced marker styling, icons, labels, events, draggable markers, and clustering. The demo view registers both routes. The project version changes to 2.7.0-SNAPSHOT, and the Vaadin 25 demo dependency version changes to 5.5.0.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Low

Suggested reviewers: javier-godoy

Merge Risk: ⚪ Minimal · up to 84ee8

The change adds an advanced marker API alongside the existing marker and updates package versions. No concrete merge-blocking risk was identified in the supplied context.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 67.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 8 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Issue [#121] asks for investigation of the deprecated google.maps.Marker warning and links to the Advanced Markers migration. The PR adds GoogleMapAdvancedMarker backed by AdvancedMarkerElement,…
Out of Scope Changes check Passed The changes stay connected to issue [#121]. The new public API, Map ID checks, dependency updates, clustering support, version change, demos, and Vaadin profile update support or demonstrate the Advan…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: adding the GoogleMapAdvancedMarker API. It matches the implementation and the stated pull request objective.
Full details: Docstring Coverage

Explanation

Docstring coverage is 67.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 8 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@paodb

paodb commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

Code duplication
SonarCloud reports duplication between GoogleMapAdvancedMarker and GoogleMapMarker: the getters and setters both markers share (position, caption, draggable, icon, label and info window). It's intentional: as decided in the issue, both classes coexist and GoogleMapMarker is left unchanged, so it isn't refactored here. A common base class could be extracted in a separate PR.

@paodb
paodb marked this pull request as ready for review October 14, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Do

Development

Successfully merging this pull request may close these issues.

"google.maps.Marker is deprecated" warning

1 participant