public static TileExtents computeFromWorldBounds(int maxzoom, Envelope worldBounds, Geometry shape) {
    ForZoom[] zoomExtents = new ForZoom[maxzoom + 1];
    var mercator = shape == null ? null : GeoUtils.latLonToWorldCoords(shape);
    for (int zoom = 0; zoom <= maxzoom; zoom++) {
      int max = 1 << zoom;

      var forZoom = new ForZoom(
        zoom,
        quantizeDown(worldBounds.getMinX(), max),
        quantizeDown(worldBounds.getMinY(), max),
        quantizeUp(worldBounds.getMaxX(), max),
        quantizeUp(worldBounds.getMaxY(), max),
        null
      );

      if (mercator != null) {
        Geometry scaled = AffineTransformation.scaleInstance(1 << zoom, 1 << zoom).transform(mercator);
        TiledGeometry.CoveredTiles covered;
        try {
          covered = TiledGeometry.getCoveredTiles(scaled, zoom, forZoom);
        } catch (GeometryException e) {
          throw new IllegalArgumentException("Invalid geometry: " + scaled);
        }
        forZoom = forZoom.withShape(covered);
        LOGGER.info("prepareShapeForZoom z{} {}", zoom, covered);
      }

      zoomExtents[zoom] = forZoom;
    }
    return new TileExtents(zoomExtents);
  }
Returns a filter to tiles that intersect {@code worldBounds} (specified in world web mercator coordinates).
planetiler-core/src/main/java/com/onthegomap/planetiler/geo/TileExtents.java