Decode an MVT tile and convert all features to a GeoJSON FeatureCollection string.
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":[...]}' Copy
const response = await fetch('/tiles/10/868/387.pbf');const geojson = decodeMvtToGeoJson(new Uint8Array(await response.arrayBuffer()));// geojson = '{"type":"FeatureCollection","features":[...]}'
Decode an MVT tile and convert all features to a GeoJSON FeatureCollection string.
Parameters
bytes— Raw MVT protobuf bytes.Returns
A GeoJSON FeatureCollection string with all features from the first layer. Coordinates are in tile space (0..extent).
Usage (JS)