Skip to content

feat(google-maps): add heatmap support#21489

Merged
annieyw merged 1 commit intoangular:masterfrom
crisbeto:google-heatmap
Feb 7, 2021
Merged

feat(google-maps): add heatmap support#21489
annieyw merged 1 commit intoangular:masterfrom
crisbeto:google-heatmap

Conversation

@crisbeto
Copy link
Copy Markdown
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 a review from devversion as a code owner January 3, 2021 11:45
@crisbeto crisbeto requested a review from a team 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
Copy Markdown
Contributor

@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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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