Skip to content

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