@maplibre/geojson-vt
    Preparing search index...

    Function geoJSONToTile

    • Converts GeoJSON data directly to a single vector tile without building a tile index.

      Unlike the GeoJSONVT class which builds a hierarchical tile index for efficient repeated tile access, this function generates a single tile on-demand. This is useful when:

      • You only need one specific tile and don't need to query multiple tiles
      • The source data is already spatially filtered to the tile's bounding box
      • You want to avoid the overhead of building a full tile index

      Parameters

      • data: GeoJSON

        GeoJSON data (Feature, FeatureCollection, or Geometry)

      • z: number

        Tile zoom level

      • x: number

        Tile x coordinate

      • y: number

        Tile y coordinate

      • options: GeoJSONToTileOptions = {}

        Optional configuration for tile generation

      Returns GeoJSONVTTile

      The generated tile with geometries in tile coordinates, or null if no features

      import {geoJSONToTile} from '@maplibre/geojson-vt';

      const geojson = {
      type: 'FeatureCollection',
      features: [{
      type: 'Feature',
      geometry: { type: 'Point', coordinates: [-77.03, 38.90] },
      properties: { name: 'Washington, D.C.' }
      }]
      };

      const tile = geoJSONToTile(geojson, 10, 292, 391, { extent: 4096 });