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 heatmap support #21489

Merged
merged 1 commit into from
Feb 7, 2021

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Jan 3, 2021

Adds support for rendering heatmaps on the google-map component using the map-heatmap-layer directive. The directive is mostly a direct wrapper around the google.maps.visualization.HeatmapLayer class, except for the fact that it also accepts a LatLngLiteral, whereas the Google Maps class only accepts LatLng objects. I decided to add some logic to convert them automatically, because creating LatLng requires the Maps API to have been loaded which can lead to race conditions if it's being loaded lazily.

Example

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: minor This PR is targeted for the next minor release labels Jan 3, 2021
@crisbeto crisbeto requested review from devversion and a team as code owners January 3, 2021 11:45
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 3, 2021
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM, though @mbehrlich should also take a look

}

if (changes['data'] && _data !== undefined) {
// TODO(crisbeto): the API allows for `MVCArray<LatLng|WeightedLocation>` or
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth sending a PR to fix the types?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was planning on sending out out, but I haven't gotten around to it yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

</head>
```

**Note:**
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are several classes that we may want to implement in the future that also require adding separate libraries. Should we make this note more general, to apply to several components, while giving more specific instructions about which library to use in the component-specific readme?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it may be too vague if we're doing it now since there aren't any other components that use this approach. It might be better to do it once we have other components.

@crisbeto crisbeto force-pushed the google-heatmap branch 2 times, most recently from 87d2c81 to c17ec2b Compare January 6, 2021 09:17
Copy link
Collaborator

@mbehrlich mbehrlich left a comment

Choose a reason for hiding this comment

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

LGTM

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Jan 8, 2021
@crisbeto crisbeto force-pushed the google-heatmap branch 2 times, most recently from a3a1266 to cc428ad Compare January 11, 2021 19:06
@annieyw
Copy link
Contributor

annieyw commented Feb 5, 2021

@crisbeto needs rebase

Adds support for rendering heatmaps on the `google-map` component using the
`map-heatmap-layer` directive. The directive is mostly a direct wrapper around the
`google.maps.visualization.HeatmapLayer` class, except for the fact that it also accepts a
`LatLngLiteral`, whereas the Google Maps class only accepts `LatLng` objects. I decided
to add some logic to convert them automatically, because creating `LatLng` requires
the Maps API to have been loaded which can lead to race conditions if it's being loaded
lazily.
@crisbeto
Copy link
Member Author

crisbeto commented Feb 5, 2021

Rebased @annieyw.

@annieyw annieyw merged commit 09581ee into angular:master Feb 7, 2021
wagnermaciel pushed a commit to wagnermaciel/components that referenced this pull request Feb 8, 2021
Adds support for rendering heatmaps on the `google-map` component using the
`map-heatmap-layer` directive. The directive is mostly a direct wrapper around the
`google.maps.visualization.HeatmapLayer` class, except for the fact that it also accepts a
`LatLngLiteral`, whereas the Google Maps class only accepts `LatLng` objects. I decided
to add some logic to convert them automatically, because creating `LatLng` requires
the Maps API to have been loaded which can lead to race conditions if it's being loaded
lazily.
wagnermaciel pushed a commit to wagnermaciel/components that referenced this pull request Feb 8, 2021
Adds support for rendering heatmaps on the `google-map` component using the
`map-heatmap-layer` directive. The directive is mostly a direct wrapper around the
`google.maps.visualization.HeatmapLayer` class, except for the fact that it also accepts a
`LatLngLiteral`, whereas the Google Maps class only accepts `LatLng` objects. I decided
to add some logic to convert them automatically, because creating `LatLng` requires
the Maps API to have been loaded which can lead to race conditions if it's being loaded
lazily.
@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 10, 2021
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 cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants