This canvas map use rbush to create a R-tree-based 2D spatial index for a best hover effect performance.
The idea is to create a canvas
basemap where a svg
path
appears to create the hover effect.
Spain has more than 8120 municipalities (features) so it's a great scenario to test this idea. Thanks to rbush
its not necessary to iterate along the whole feature set to extract the feature where user is hovering.
Inspiration implementation comes from spamjs. Data from ElConfidencial.com