Skip to main content

partition_features_by_tile

Function partition_features_by_tile 

Source
pub fn partition_features_by_tile(
    features: &FeatureCollection,
    zoom: u8,
) -> HashMap<TileId, FeatureCollection>
Expand description

Partition a feature collection into per-tile sub-collections.

Each feature is assigned to exactly one tile based on its representative coordinate (first vertex). Features whose geometry has no coordinates are dropped.

§Arguments

  • features - The source feature collection to partition.
  • zoom - The zoom level at which to compute tile assignments.

§Returns

A map from TileId to the subset of features that fall within that tile.