wasm-spatial-core
    Preparing search index...

    Function decodeMvtToGeoJson

    • Decode an MVT tile and convert all features to a GeoJSON FeatureCollection string.

      • bytes — Raw MVT protobuf bytes.

      A GeoJSON FeatureCollection string with all features from the first layer. Coordinates are in tile space (0..extent).

      const response = await fetch('/tiles/10/868/387.pbf');
      const geojson = decodeMvtToGeoJson(new Uint8Array(await response.arrayBuffer()));
      // geojson = '{"type":"FeatureCollection","features":[...]}'

      Parameters

      • bytes: Uint8Array

      Returns string