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

Add support for heatmap.js layer #115

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from

Conversation

jasperfirecai2
Copy link

This allows users to export their map, in addition to their Heatmap.js data (using the leaflet-heatmap.js plugin) as a single image/canvas/whatever you want to call it.

I personally needed this and I was hoping I could find a solution but instead i wrote my own. (whoops)

Heatmap.js (using the leaflet plugin) uses its own canvas for rendering. if we allow leaflet-image to apply its usual logic behind canvas layers, the output is distorted. instead, i have it draw the heatmap's own exportable dataURL. I'm hoping that the way i wrote this is compatible with environments without heatmap.js.

Heatmap.js (using the leaflet plugin) uses its own canvas for rendering. if we allow leaflet-image to apply its usual logic behind canvas layers, the output is distorted. instead, i have it draw the heatmap's own exportable dataURL. I'm hoping that the way i wrote this is compatible with environments without heatmap.js.
@jasperfirecai2
Copy link
Author

As a side note, this is obviously not written in the best way possible, this was quick and goal-oriented code. I appreciate any suggestions for improvements.

Since we want to render heatmap even if it's not the first canvas element, i have it cycle through all. this fixes an issue where if you removed the heatmap and re-added it later it wouldn't be drawn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant