code: def compute_zoom_level(bounds, domain, levels):
      
      area_fraction = min(bounds.area/domain.area, 1)
      return int(min(round(np.log2(1/area_fraction)), levels))
docs: Computes a zoom level given a bounds polygon, a polygon of the
      overall domain and the number of zoom levels to divide the data
      into.
  
      Parameters
      ----------
      bounds: shapely.geometry.Polygon
          Polygon representing the area of the current viewport
      domain: shapely.geometry.Polygon
          Polygon representing the overall bounding region of the data
      levels: int
          Number of zoom levels to divide the domain into
  
      Returns
      -------
      zoom_level: int
          Integer zoom level