I was looking at this Carto Map. You can click on a building and it shows some extra information about it.
Then I noticed that these buildings weren't added as individual polygons or something like that, but instead are part of generated tiles that has been added to the map. Here is a an example of a single tile.
If you look at the code these tiles have the leaflet-tile
class, so it seems like Carto are using Leaflet for adding the tiles to the map.
But how is it possible that there is interaction? I don't think it's possible to interact with PNG files like this, so what is going on?
I have a large dataset of buildings. If I add them to a map using Leaflet the map gets really slow, so I would like to use something like Mapnik to generate the tiles and make things a lot faster. But as far as I know I will then lose interactivity, which is a real shame.
Is there a way to use Leaflet to add tiles rather than features and keep interactivity with the features that are generated onto the tiles?