Function S2CellId.maximumTile

Returns the largest cell with the same range_min() and such that range_max() < limit.range_min().

S2CellId maximumTile (
  S2CellId limit
) const;

Returns "limit" if no such cell exists. This method can be used to generate a small set of S2CellIds that covers a given range \(a "tiling"\). This example shows how to generate a tiling for a semi-open range of leaf cells \[start, limit\):

for (S2CellId id = start.maximum_tile(limit);
     id != limit; id = id.next().maximum_tile(limit)) { ... }

Note that in general the cells in the tiling will be of different sizes; they gradually get larger \(near the middle of the range\) and then gradually get smaller \(as "limit" is approached\).