I have created a map using leaflet, with polygons. Each polygon has its proper color(style) based on the number of inhabitants. please see the following example: Map
I want to merge polygons as I zoom out. for example: after every 2 zoom levels, I want to aggregate 2 adjacent polygons into one, where the inhabitant number of the new polygon is the addition of the volumes of the previous 2 aggregated polygons. I found that there is a method called turf.union that is able to merge polygons. But the issue that I have is in term of the algorithm that will be identifying adjacent polygons and returning them. How can I achieve that? is there any library that can help me achieve that ?