Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(google-maps): add advanced marker #28525

Merged
merged 3 commits into from
Feb 8, 2024

Conversation

OgiSss
Copy link
Contributor

@OgiSss OgiSss commented Feb 1, 2024

This commit introduces the advanced-marker feature to the map package, enabling users to add custom, interactive markers to their maps.

Related #25897

@OgiSss OgiSss requested a review from crisbeto as a code owner February 1, 2024 20:45
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Feb 1, 2024
@OgiSss OgiSss force-pushed the google-maps-advanced-marker branch 2 times, most recently from 33c1a6e to f0c7fa8 Compare February 7, 2024 13:49
@OgiSss OgiSss requested a review from crisbeto February 8, 2024 08:34
@crisbeto
Copy link
Member

crisbeto commented Feb 8, 2024

Before I can land the change you also have to run yarn approve-api google-maps and push the result.

This commit introduces the advanced-marker feature to the map package, enabling users to add custom, interactive markers to their maps.

Related angular#25897
… description property for advanced markers
@OgiSss OgiSss force-pushed the google-maps-advanced-marker branch from f0c7fa8 to 8ac5ea0 Compare February 8, 2024 20:36
@angular-robot angular-robot bot requested a review from crisbeto February 8, 2024 20:36
@OgiSss OgiSss changed the title feat(google-maps/advanced-marker): add advanced marker feat(google-maps): add advanced marker Feb 8, 2024
@crisbeto crisbeto self-assigned this Feb 8, 2024
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Feb 8, 2024
@crisbeto crisbeto merged commit b4b91be into angular:main Feb 8, 2024
@OgiSss OgiSss deleted the google-maps-advanced-marker branch February 9, 2024 19:50
advancedMarker.gmpDraggable = _draggable;
}

if (changes['content']) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is here a second time... It should be removed

@mrigi
Copy link

mrigi commented Feb 25, 2024

Any ETA when we can see this released as part of @angular/google-maps?
Because usage of map-marker brings deprecation message in console which says that MapMarker won't be supported as of 21-Feb-2024. And that date is already in the past.

@Akxe
Copy link

Akxe commented Feb 25, 2024

@mrigi in 17.3.0 (https://github.com/angular/components/releases/tag/17.3.0-next.0)

@ettubrute47
Copy link

Sorry in advance if this isn't the place to put this, but wanted to give some feedback / raise some questions:

I've been playing with the 17.3.0-next.0 pre-release to use the advanced markers and noticed 2 things:

First isn't related to the angular component implementation but advanced markers themselves. I had to create a map Id in google cloud console to display the advanced markers for some reason. I have a feature to 'toggle' visibility of points-of-interests via the map options.styles but since I'm using mapId I get an error saying I can only change style via cloud. I made a new style and mapId and try to change map Id's as a workaround but I got the same 'can't change style if using map Id' error... The google map component has an option for setting mapId programmatically, so you'd think you'd be able to change it? My understanding is I have to choose between dynamically styling maps and displaying advanced markers.

Second thing is when I create advanced markers sequentially inside a component which gets access to AdvancedMarkerElement via ViewChild, the first marker fires off ngAfterViewInit and then the EventEmitter markerInitialized is fired. Subsequent markers flips execution order. To access this.marker.AdvancedMarker,I have to put the code both in the handler for markerInitialized and ngAfterViewInit since sometimes they exist in one only or the other. Not sure if this is expected behavior.

@wandaatest
Copy link

Hi i tried advanced marker in marker-clusterer, it doesn't work, but works in <map-marker> tag

<google-map #map
              height="100%" width="100%"
              [center]="center"
              [options]="mapOptions">
    <map-marker-clusterer [gridSize]="30"
                      [imagePath]="markerClustererImagePath">
      @for (position of markers; track position) {
      <map-advanced-marker [position]="position"></map-advanced-marker>
      }
    </map-marker-clusterer>
</google-map>

@OgiSss
Copy link
Contributor Author

OgiSss commented Feb 29, 2024

@wandaatest

Hi i tried advanced marker in marker-clusterer, it doesn't work, but works in <map-marker> tag

<google-map #map
              height="100%" width="100%"
              [center]="center"
              [options]="mapOptions">
    <map-marker-clusterer [gridSize]="30"
                      [imagePath]="markerClustererImagePath">
      @for (position of markers; track position) {
      <map-advanced-marker [position]="position"></map-advanced-marker>
      }
    </map-marker-clusterer>
</google-map>

Ok I've found an issue under the hood we use https://www.npmjs.com/package/@googlemaps/markerclustererplus which is deprecated and in my opinion we have to rewrite the MapMarkerClusterer component from scratch and align to this library https://www.npmjs.com/package/@googlemaps/markerclusterer which is recommended.

@crisbeto it is up to you I can take care of this

@crisbeto
Copy link
Member

I've had a PR for the alternate clusterer for a while (#24853), but it's unclear how we can roll it out given that the API is completely different. We might just have to maintain two clusterers.

@OgiSss
Copy link
Contributor Author

OgiSss commented Feb 29, 2024

Indeed, it seems prudent to maintain two clusters, designating one as deprecated. The same situation is with google.maps.Marker
https://developers.google.com/maps/documentation/javascript/markers based on the documentation markers are legacy.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants