Skip to main content

binaryToGeojson

Helper function to transform binary GeoJSON generated by geojsonToBinary back to a valid GeoJSON Geometry, Feature or array of Features.

Usage

import {load} from '@loaders.gl/core';
import {JSONLoader} from '@loaders.gl/json';
import {geojsonToBinary, binaryToGeojson} from '@loaders.gl/gis';

const geoJSONfeatures = await load('data.geojson', JSONLoader);
const binaryFeatures = geojsonToBinary(geoJSONfeatures);
const geoJSONfeatures2 = binaryToGeoJson(binaryFeatures);

Options

OptionTypeDefaultDescription
type'Point' | 'LineString' | 'Polygon'(derived from data)Geometry type
globalFeatureIdnumberIf specified, only returns the feature that matches the given global id.