Sign in

    moon-flatgeobuf

    FlatGeobuf 2D feature codec, packed spatial index, and bounded random-access queries

    flatgeobuf
    gis
    geospatial
    spatial-index
    Download zip
    Version
    0.1.0
    License
    BSD-2-Clause
    Last updated
    14 hours ago
    Downloads
    2

    #Moon FlatGeobuf

    English · 中文说明

    Pure MoonBit FlatGeobuf 2D feature reader/writer, packed spatial-index queries, incremental streams, and a transport-independent HTTP Range query state machine. Use it to exchange .fgb files with existing GIS tools, select a local region, or load only the matching features from an object-storage archive.

    #Install

    moon add moyunijieshi1/moon-flatgeobuf

    Import the library in moon.pkg:

    import {
    "moyunijieshi1/moon-flatgeobuf" @fgb,
    }

    The pure codec has no third-party runtime dependencies. It uses MoonBit core. The Node.js CLI and HTTP adapter are optional hosts; the official JavaScript FlatGeobuf package is a development-only independent test oracle.

    #Library example

    let header = @fgb.Header::new(@fgb.Point, [@fgb.Column::new("name", 11)])
    let dataset : @fgb.Dataset = {
    header,
    features: [{
    geometry: Some(@fgb.Geometry::point(116.4, 39.9)),
    properties: [@fgb.Text("Beijing")],
    }],
    }
    let bytes = @fgb.write_dataset(dataset)
    let reader = @fgb.Reader::open(bytes)
    reader.validate()
    let hits = reader.query({
    min_x: 116.0, min_y: 39.0, max_x: 117.0, max_y: 40.0,
    })

    Run the complete example with moon run examples/basic --target js.

    #CLI

    Node.js 24 is required by the acceptance scripts. Build the MoonBit host first:

    moon build --target js node scripts/cli.cjs encode examples/places.geojson places.fgb node scripts/cli.cjs inspect places.fgb node scripts/cli.cjs validate places.fgb node scripts/cli.cjs query places.fgb 115 38 118 41 selected.geojson node scripts/cli.cjs decode places.fgb restored.geojson node scripts/cli.cjs remote https://your-host/data.fgb 115 38 118 41 remote.geojson

    Outputs are created exclusively: an existing destination causes an error. The remote command needs HTTP 206, a correct Content-Range, a strong ETag, unchanged object size, and identity content encoding. It sends If-Match after the first response. Redirects and servers ignoring Range are rejected. The actual socket/filesystem work is in Node.js; binary parsing, traversal, response validation, and query state transitions are implemented in MoonBit.

    #Scope

    • Six 2D families: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon; null geometries in unindexed files.
    • All 15 standard attribute types; Int64/UInt64 remain exact in the MoonBit API.
    • Header, column and CRS metadata; fixed dataset-wide schemas.
    • Sequential, ordinal and indexed bounding-box access; field projection, property predicates, pagination and GeoJSON conversion.
    • Packed file index read/write; deterministic Hilbert sorting on write.
    • Incremental stream decoding that discards index bytes; unindexed streaming writer with an unknown count; bounded range cache and request coalescing.
    • Structural audit, uniqueness checks and dataset statistics.

    Bounding-box matches are candidates, not exact polygon intersections. The library does not reproject coordinates or render maps. Z/M/T/TM, geometry collections, curve geometries and per-feature schemas are explicitly unsupported. Offsets use a bounded Int32 address space. Defaults cap files at 1 GiB and features at 16 MiB; see Limits and SUPPORTED_FORMAT.md.

    Indexed queries trust the on-disk index for pruning. Call Reader::validate before querying an untrusted local archive when completeness matters. A partial remote query cannot prove the correctness of unvisited subtrees.

    #Verification

    moon fmt --check moon check --target all --deny-warn moon build --target all --deny-warn moon test --target all --deny-warn moon run examples/basic --target js npm ci --ignore-scripts node scripts/interop.cjs node scripts/http-test.cjs node scripts/malformed.cjs python3 scripts/count-lines.py

    --target all includes native and requires a C toolchain; Linux GitHub Actions provides one. JS and WasmGC checks also run locally on Windows. See INTEROPERABILITY.md for evidence and limitations.

    #Source and license

    BSD-2-Clause. This is an independent MoonBit implementation of the published FlatGeobuf format, with documented reference behavior. No claim is made to be the official FlatGeobuf project. See THIRD_PARTY.md.

    FgbError

    pub suberror FgbError {
    InvalidData(Int, String)
    Unsupported(String)
    LimitExceeded(String)
    InvalidArgument(String)
    } derive(
    Debug
    )

    FgbError::to_repr

    ArchiveSummary

    pub(all) struct ArchiveSummary {
    file_bytes : Int
    header_bytes : Int
    index_bytes : Int
    feature_bytes : Int
    minimum_record_bytes : Int
    maximum_record_bytes : Int
    dataset : DatasetSummary
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ArchiveSummary::equal

    ArchiveSummary::not_equal

    fn ArchiveSummary::not_equal(x : ArchiveSummary, y : ArchiveSummary) -> Bool

    ArchiveSummary::to_json

    Bounds

    pub(all) struct Bounds {
    min_x : Double
    min_y : Double
    max_x : Double
    max_y : Double
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Bounds::contains

    fn Bounds::contains(self : Bounds, other : Bounds) -> Bool

    Bounds::equal

    fn Bounds::equal(Bounds, Bounds) -> Bool

    Bounds::intersects

    fn Bounds::intersects(self : Bounds, other : Bounds) -> Bool

    Bounds::not_equal

    fn Bounds::not_equal(x : Bounds, y : Bounds) -> Bool

    Bounds::to_json

    fn Bounds::to_json(Bounds) -> Json

    Bounds::to_repr

    Bounds::union

    fn Bounds::union(self : Bounds, other : Bounds) -> Bounds

    Bounds::validate

    fn Bounds::validate(self : Bounds) -> Unit raise FgbError

    ByteRange

    pub(all) struct ByteRange {
    start : Int
    length : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ByteRange::end_inclusive

    fn ByteRange::end_inclusive(self : ByteRange) -> Int raise FgbError

    ByteRange::equal

    fn ByteRange::equal(ByteRange, ByteRange) -> Bool

    ByteRange::http_header

    fn ByteRange::http_header(self : ByteRange) -> String raise FgbError

    ByteRange::not_equal

    fn ByteRange::not_equal(x : ByteRange, y : ByteRange) -> Bool

    ByteRange::to_json

    fn ByteRange::to_json(ByteRange) -> Json

    ByteWriter

    type ByteWriter

    CacheStats

    pub(all) struct CacheStats {
    hits : Int
    misses : Int
    evictions : Int
    retained_bytes : Int
    entries : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    CacheStats::equal

    fn CacheStats::equal(CacheStats, CacheStats) -> Bool

    CacheStats::not_equal

    fn CacheStats::not_equal(x : CacheStats, y : CacheStats) -> Bool

    CacheStats::to_json

    fn CacheStats::to_json(CacheStats) -> Json

    CachedRange

    type CachedRange

    Column

    pub(all) struct Column {
    name : String
    type_code : Int
    nullable : Bool
    title : String
    description : String
    width : Int
    precision : Int
    scale : Int
    unique : Bool
    primary_key : Bool
    metadata : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Column::equal

    fn Column::equal(Column, Column) -> Bool

    Column::new

    fn Column::new(name : String, type_code : Int, nullable? : Bool) -> Column

    Column::not_equal

    fn Column::not_equal(x : Column, y : Column) -> Bool

    Column::to_json

    fn Column::to_json(Column) -> Json

    Column::to_repr

    Column::type_name

    fn Column::type_name(self : Column) -> String

    ColumnSummary

    pub(all) struct ColumnSummary {
    name : String
    type_name : String
    nulls : Int
    present : Int
    minimum : String?
    maximum : String?
    total_bytes : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ColumnSummary::equal

    ColumnSummary::not_equal

    fn ColumnSummary::not_equal(x : ColumnSummary, y : ColumnSummary) -> Bool

    ColumnSummary::to_json

    ContentRange

    pub(all) struct ContentRange {
    start : Int
    end_inclusive : Int
    total : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ContentRange::equal

    ContentRange::not_equal

    fn ContentRange::not_equal(x : ContentRange, y : ContentRange) -> Bool

    ContentRange::to_json

    Coordinate

    pub(all) struct Coordinate {
    x : Double
    y : Double
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Coordinate::equal

    fn Coordinate::equal(Coordinate, Coordinate) -> Bool

    Coordinate::not_equal

    fn Coordinate::not_equal(x : Coordinate, y : Coordinate) -> Bool

    Coordinate::to_json

    fn Coordinate::to_json(Coordinate) -> Json

    Crs

    pub(all) struct Crs {
    org : String
    code : Int
    name : String
    description : String
    wkt : String
    code_string : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Crs::epsg

    fn Crs::epsg(code : Int) -> Crs

    Crs::equal

    fn Crs::equal(Crs, Crs) -> Bool

    Crs::not_equal

    fn Crs::not_equal(x : Crs, y : Crs) -> Bool

    Crs::to_json

    fn Crs::to_json(Crs) -> Json

    Crs::to_repr

    Dataset

    pub(all) struct Dataset {
    header : Header
    features : Array[Feature]
    } derive(Eq,
    Debug
    )

    Dataset::equal

    fn Dataset::equal(Dataset, Dataset) -> Bool

    Dataset::not_equal

    fn Dataset::not_equal(x : Dataset, y : Dataset) -> Bool

    Dataset::project

    fn Dataset::project(self : Dataset, fields : Array[String]) -> Dataset raise FgbError

    Dataset::summarize

    fn Dataset::summarize(self : Dataset, limits? : Limits) -> DatasetSummary raise FgbError

    Dataset::to_geojson

    fn Dataset::to_geojson(self : Dataset, allow_projected? : Bool) -> Json raise FgbError

    Dataset::to_repr

    Dataset::validate

    fn Dataset::validate(self : Dataset, limits? : Limits, max_diagnostics? : Int) -> ValidationReport raise FgbError

    DatasetSummary

    pub(all) struct DatasetSummary {
    features : Int
    null_geometries : Int
    coordinates : Int
    envelope : Bounds?
    geometry_types : Array[(String, Int)]
    columns : Array[ColumnSummary]
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    DatasetSummary::equal

    DatasetSummary::not_equal

    fn DatasetSummary::not_equal(x : DatasetSummary, y : DatasetSummary) -> Bool

    DatasetSummary::to_json

    DecodeStage

    type DecodeStage

    Diagnostic

    pub(all) struct Diagnostic {
    severity : String
    code : String
    message : String
    feature : Int?
    column : String?
    byte_offset : Int?
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Diagnostic::equal

    fn Diagnostic::equal(Diagnostic, Diagnostic) -> Bool

    Diagnostic::not_equal

    fn Diagnostic::not_equal(x : Diagnostic, y : Diagnostic) -> Bool

    Diagnostic::to_json

    fn Diagnostic::to_json(Diagnostic) -> Json

    Feature

    pub(all) struct Feature {
    geometry : Geometry?
    properties : Array[Property]
    } derive(Eq,
    Debug
    )

    Feature::bounds

    fn Feature::bounds(self : Feature) -> Bounds?

    Feature::equal

    fn Feature::equal(Feature, Feature) -> Bool

    Feature::not_equal

    fn Feature::not_equal(x : Feature, y : Feature) -> Bool

    Feature::property

    fn Feature::property(self : Feature, header : Header, name : String) -> Property?

    Feature::to_geojson

    fn Feature::to_geojson(self : Feature, header : Header) -> Json raise FgbError

    Feature::to_repr

    FeatureRecord

    pub(all) struct FeatureRecord {
    ordinal : Int
    offset : Int
    byte_length : Int
    feature : Feature
    } derive(Eq,
    Debug
    )

    FeatureRecord::equal

    FeatureRecord::not_equal

    fn FeatureRecord::not_equal(x : FeatureRecord, y : FeatureRecord) -> Bool

    Geometry

    Geometry::bounds

    fn Geometry::bounds(self : Geometry) -> Bounds?

    Geometry::coordinate_count

    fn Geometry::coordinate_count(self : Geometry) -> Int

    Geometry::equal

    fn Geometry::equal(Geometry, Geometry) -> Bool

    Geometry::not_equal

    fn Geometry::not_equal(x : Geometry, y : Geometry) -> Bool

    Geometry::point

    fn Geometry::point(x : Double, y : Double) -> Geometry

    Geometry::to_geojson

    fn Geometry::to_geojson(self : Geometry) -> Json raise FgbError

    Geometry::to_json

    fn Geometry::to_json(Geometry) -> Json

    Geometry::to_repr

    Geometry::validate

    fn Geometry::validate(self : Geometry, limits? : Limits) -> Unit raise FgbError

    Geometry::validate_wgs84

    fn Geometry::validate_wgs84(self : Geometry, limits? : Limits) -> Unit raise FgbError

    GeometryKind

    pub(all) enum GeometryKind {
    Unknown
    Point
    LineString
    Polygon
    MultiPoint
    MultiLineString
    MultiPolygon
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    GeometryKind::code

    fn GeometryKind::code(self : GeometryKind) -> Int

    GeometryKind::equal

    GeometryKind::name

    fn GeometryKind::name(self : GeometryKind) -> String

    GeometryKind::not_equal

    fn GeometryKind::not_equal(x : GeometryKind, y : GeometryKind) -> Bool

    GeometryKind::to_json

    pub(all) struct Header {
    name : String
    geometry_kind : GeometryKind
    columns : Array[Column]
    features_count : Int
    index_node_size : Int
    envelope : Bounds?
    crs : Crs?
    title : String
    description : String
    metadata : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Header::column

    fn Header::column(self : Header, name : String) -> Column?

    Header::equal

    fn Header::equal(Header, Header) -> Bool

    Header::is_wgs84

    fn Header::is_wgs84(self : Header) -> Bool

    Header::new

    fn Header::new(kind : GeometryKind, columns : Array[Column]) -> Header

    Header::not_equal

    fn Header::not_equal(x : Header, y : Header) -> Bool

    Header::to_json

    fn Header::to_json(Header) -> Json

    Header::to_repr

    Header::validate_geojson_crs

    fn Header::validate_geojson_crs(self : Header, assume_wgs84? : Bool) -> Unit raise FgbError

    IndexHit

    pub(all) struct IndexHit {
    ordinal : Int
    offset : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    IndexHit::equal

    fn IndexHit::equal(IndexHit, IndexHit) -> Bool

    IndexHit::not_equal

    fn IndexHit::not_equal(x : IndexHit, y : IndexHit) -> Bool

    IndexHit::to_json

    fn IndexHit::to_json(IndexHit) -> Json

    IndexHit::to_repr

    IndexLevel

    pub(all) struct IndexLevel {
    start : Int
    end : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    IndexLevel::equal

    fn IndexLevel::equal(IndexLevel, IndexLevel) -> Bool

    IndexLevel::not_equal

    fn IndexLevel::not_equal(x : IndexLevel, y : IndexLevel) -> Bool

    IndexLevel::to_json

    fn IndexLevel::to_json(IndexLevel) -> Json

    IndexNode

    pub(all) struct IndexNode {
    bounds : Bounds
    offset : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    IndexNode::equal

    fn IndexNode::equal(IndexNode, IndexNode) -> Bool

    IndexNode::not_equal

    fn IndexNode::not_equal(x : IndexNode, y : IndexNode) -> Bool

    IndexNode::to_json

    fn IndexNode::to_json(IndexNode) -> Json

    Limits

    pub(all) struct Limits {
    max_header_bytes : Int
    max_feature_bytes : Int
    max_features : Int
    max_columns : Int
    max_coordinates : Int
    max_string_bytes : Int
    max_depth : Int
    max_index_nodes : Int
    max_file_bytes : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Limits::default

    fn Limits::default() -> Limits

    Limits::equal

    fn Limits::equal(Limits, Limits) -> Bool

    Limits::not_equal

    fn Limits::not_equal(x : Limits, y : Limits) -> Bool

    Limits::to_json

    fn Limits::to_json(Limits) -> Json

    Limits::to_repr

    Limits::validate

    fn Limits::validate(self : Limits) -> Unit raise FgbError

    Predicate

    pub(all) enum Predicate {
    Equal(String, Property)
    NotEqual(String, Property)
    IsNull(String)
    IsNotNull(String)
    NumericRange(String, Double?, Double?)
    TextContains(String, String)
    All(Array[Predicate])
    Any(Array[Predicate])
    Not(Predicate)
    } derive(Eq,
    Debug
    )

    Predicate::equal

    fn Predicate::equal(Predicate, Predicate) -> Bool

    Predicate::not_equal

    fn Predicate::not_equal(x : Predicate, y : Predicate) -> Bool

    Property

    pub(all) enum Property {
    Null
    Integer(Int64)
    Unsigned(UInt64)
    Real(Double)
    Boolean(Bool)
    Text(String)
    Binary(Bytes)
    } derive(Eq,
    Debug
    )

    Property::equal

    fn Property::equal(Property, Property) -> Bool

    Property::not_equal

    fn Property::not_equal(x : Property, y : Property) -> Bool

    Property::to_json_value

    fn Property::to_json_value(self : Property) -> Json

    Property::to_repr

    QueryStep

    type QueryStep

    RangeCache

    pub struct RangeCache {
    capacity : Int
    max_entries : Int
    validator : String
    entries_ : Array[CachedRange]
    retained : Int
    hits : Int
    misses : Int
    evictions : Int
    }

    A cache belongs to one resource. Switching URL requires clear(), even if ETags match.

    RangeCache::clear

    fn RangeCache::clear(self : RangeCache) -> Unit

    RangeCache::get

    fn RangeCache::get(self : RangeCache, range : ByteRange, etag : String) -> Bytes? raise FgbError

    RangeCache::new

    fn RangeCache::new(capacity : Int, max_entries? : Int) -> RangeCache raise FgbError

    RangeCache::put

    fn RangeCache::put(self : RangeCache, range : ByteRange, bytes : Bytes, etag : String) -> Unit raise FgbError

    RangeCache::stats

    fn RangeCache::stats(self : RangeCache) -> CacheStats

    RangeQuery

    pub struct RangeQuery {
    bounds : Bounds
    limits : Limits
    header_ : Header?
    total : Int
    etag : String
    step : QueryStep
    index_start : Int
    features_start : Int
    levels : Array[IndexLevel]
    pending : Array[(Int, Int, Int)]
    pending_cursor : Int
    hits : Array[IndexHit]
    hit_cursor : Int
    features : Array[Feature]
    stats_ : TransferStats
    }

    RangeQuery::accept

    fn RangeQuery::accept(self : RangeQuery, response : RangeResponse) -> Unit raise FgbError

    RangeQuery::expected_etag

    fn RangeQuery::expected_etag(self : RangeQuery) -> String

    RangeQuery::header

    fn RangeQuery::header(self : RangeQuery) -> Header?

    RangeQuery::is_complete

    fn RangeQuery::is_complete(self : RangeQuery) -> Bool

    RangeQuery::is_failed

    fn RangeQuery::is_failed(self : RangeQuery) -> Bool

    RangeQuery::new

    fn RangeQuery::new(bounds : Bounds, limits? : Limits) -> RangeQuery raise FgbError

    RangeQuery::request

    fn RangeQuery::request(self : RangeQuery) -> ByteRange? raise FgbError

    RangeQuery::result

    fn RangeQuery::result(self : RangeQuery) -> Dataset raise FgbError

    RangeQuery::stats

    fn RangeQuery::stats(self : RangeQuery) -> TransferStats

    RangeResponse

    pub(all) struct RangeResponse {
    status : Int
    content_range : String
    etag : String
    body : Bytes
    } derive(Eq,
    Debug
    )

    RangeResponse::equal

    RangeResponse::not_equal

    fn RangeResponse::not_equal(x : RangeResponse, y : RangeResponse) -> Bool

    Reader

    pub struct Reader {
    data : Bytes
    header_ : Header
    limits : Limits
    index_start : Int
    index_size : Int
    features_start : Int
    cursor : Int
    ordinal : Int
    }

    Reader::at

    fn Reader::at(self : Reader, ordinal : Int) -> FeatureRecord raise FgbError

    Reader::feature_section_offset

    fn Reader::feature_section_offset(self : Reader) -> Int

    Reader::has_index

    fn Reader::has_index(self : Reader) -> Bool

    Reader::header

    fn Reader::header(self : Reader) -> Header

    Reader::next

    fn Reader::next(self : Reader) -> FeatureRecord? raise FgbError

    Reader::open

    fn Reader::open(data : Bytes, limits? : Limits) -> Reader raise FgbError

    Reader::query

    fn Reader::query(self : Reader, bounds : Bounds) -> Array[FeatureRecord] raise FgbError

    Reader::read_all

    fn Reader::read_all(self : Reader) -> Dataset raise FgbError

    Reader::rewind

    fn Reader::rewind(self : Reader) -> Unit

    Reader::select

    fn Reader::select(self : Reader, selection : Selection) -> Dataset raise FgbError

    Reader::validate

    fn Reader::validate(self : Reader) -> Unit raise FgbError

    SchemaDifference

    pub(all) struct SchemaDifference {
    column : String
    message : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    SchemaDifference::equal

    SchemaDifference::not_equal

    fn SchemaDifference::not_equal(x : SchemaDifference, y : SchemaDifference) -> Bool

    SchemaDifference::to_json

    Selection

    pub(all) struct Selection {
    bounds : Bounds?
    predicate : Predicate?
    fields : Array[String]?
    offset : Int
    limit : Int
    } derive(Eq,
    Debug
    )

    Selection::all

    fn Selection::all() -> Selection

    Selection::equal

    fn Selection::equal(Selection, Selection) -> Bool

    Selection::not_equal

    fn Selection::not_equal(x : Selection, y : Selection) -> Bool

    StreamDecoder

    pub struct StreamDecoder {
    limits : Limits
    stage : DecodeStage
    buffer : ByteWriter
    header_ : Header?
    total_received : Int
    ordinal : Int
    feature_offset : Int
    closed : Bool
    failed : Bool
    }

    StreamDecoder::buffered_bytes

    fn StreamDecoder::buffered_bytes(self : StreamDecoder) -> Int

    StreamDecoder::features_decoded

    fn StreamDecoder::features_decoded(self : StreamDecoder) -> Int

    StreamDecoder::finish

    fn StreamDecoder::finish(self : StreamDecoder) -> Unit raise FgbError

    StreamDecoder::header

    fn StreamDecoder::header(self : StreamDecoder) -> Header?

    StreamDecoder::is_failed

    fn StreamDecoder::is_failed(self : StreamDecoder) -> Bool

    StreamDecoder::new

    fn StreamDecoder::new(limits? : Limits) -> StreamDecoder raise FgbError

    StreamDecoder::push

    fn StreamDecoder::push(self : StreamDecoder, chunk : Bytes) -> Array[FeatureRecord] raise FgbError

    StreamWriter

    pub struct StreamWriter {
    header_ : Header
    limits : Limits
    started : Bool
    closed : Bool
    feature_count : Int
    total_bytes : Int
    }

    StreamWriter::append

    fn StreamWriter::append(self : StreamWriter, feature : Feature) -> Bytes raise FgbError

    StreamWriter::begin

    fn StreamWriter::begin(self : StreamWriter) -> Bytes raise FgbError

    StreamWriter::bytes_written

    fn StreamWriter::bytes_written(self : StreamWriter) -> Int

    StreamWriter::features_written

    fn StreamWriter::features_written(self : StreamWriter) -> Int

    StreamWriter::finish

    fn StreamWriter::finish(self : StreamWriter) -> Unit raise FgbError

    StreamWriter::new

    fn StreamWriter::new(header : Header, limits? : Limits) -> StreamWriter raise FgbError

    TransferStats

    pub(all) struct TransferStats {
    requests : Int
    received_bytes : Int
    index_nodes : Int
    features_decoded : Int
    candidates : Int
    matched : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    TransferStats::equal

    TransferStats::not_equal

    fn TransferStats::not_equal(x : TransferStats, y : TransferStats) -> Bool

    TransferStats::to_json

    ValidationReport

    pub(all) struct ValidationReport {
    valid : Bool
    checked_features : Int
    diagnostics : Array[Diagnostic]
    truncated : Bool
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ValidationReport::equal

    ValidationReport::not_equal

    fn ValidationReport::not_equal(x : ValidationReport, y : ValidationReport) -> Bool

    ValidationReport::to_json

    WriteOptions

    pub(all) struct WriteOptions {
    index_node_size : Int
    hilbert_sort : Bool
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    WriteOptions::default

    fn WriteOptions::default() -> WriteOptions

    WriteOptions::equal

    WriteOptions::not_equal

    fn WriteOptions::not_equal(x : WriteOptions, y : WriteOptions) -> Bool

    WriteOptions::to_json

    audit_archive

    fn audit_archive(data : Bytes, limits? : Limits) -> ValidationReport

    coalesce_ranges

    fn coalesce_ranges(ranges : Array[ByteRange], max_gap : Int, max_length : Int) -> Array[ByteRange] raise FgbError

    Coalesce requested intervals without exceeding a caller-chosen transfer size.

    compare_schemas

    fn compare_schemas(left : Header, right : Header) -> Array[SchemaDifference]

    dataset_bounds

    fn dataset_bounds(features : Array[Feature]) -> Bounds?

    dataset_from_geojson

    fn dataset_from_geojson(value : Json, header : Header, limits? : Limits) -> Dataset raise FgbError

    decode_feature

    fn decode_feature(data : Bytes, header : Header, limits? : Limits) -> Feature raise FgbError

    decode_header

    fn decode_header(data : Bytes, limits? : Limits) -> Header raise FgbError

    decode_index_node

    fn decode_index_node(data : Bytes, node : Int) -> IndexNode raise FgbError

    decode_properties

    fn decode_properties(data : Bytes, columns : Array[Column], limits? : Limits) -> Array[Property] raise FgbError

    encode_feature

    fn encode_feature(feature : Feature, header : Header, limits? : Limits) -> Bytes raise FgbError

    encode_header

    fn encode_header(header : Header, limits? : Limits) -> Bytes raise FgbError

    encode_properties

    fn encode_properties(values : Array[Property], columns : Array[Column], limits? : Limits) -> Bytes raise FgbError

    feature_from_geojson

    fn feature_from_geojson(value : Json, header : Header, limits? : Limits) -> Feature raise FgbError

    geometry_from_geojson

    fn geometry_from_geojson(value : Json, limits? : Limits) -> Geometry raise FgbError

    import_geojson

    fn import_geojson(value : Json, name? : String, limits? : Limits) -> Dataset raise FgbError

    index_byte_length

    fn index_byte_length(count : Int, node_size : Int, limits? : Limits) -> Int raise FgbError

    index_levels

    fn index_levels(count : Int, node_size : Int, limits? : Limits) -> Array[IndexLevel] raise FgbError

    infer_geojson_header

    fn infer_geojson_header(value : Json, name? : String, limits? : Limits) -> Header raise FgbError

    inspect_archive

    fn inspect_archive(data : Bytes, limits? : Limits) -> ArchiveSummary raise FgbError

    parse_content_range

    fn parse_content_range(text : String) -> ContentRange raise FgbError

    query_index

    fn query_index(data : Bytes, count : Int, node_size : Int, query : Bounds, limits? : Limits) -> Array[IndexHit] raise FgbError

    read_dataset

    fn read_dataset(data : Bytes, limits? : Limits) -> Dataset raise FgbError

    validate_header

    fn validate_header(header : Header, limits? : Limits) -> Unit raise FgbError

    validate_index

    fn validate_index(data : Bytes, count : Int, node_size : Int, feature_bytes : Int, limits? : Limits) -> Unit raise FgbError

    validate_magic

    fn validate_magic(data : Bytes) -> Unit raise FgbError

    write_dataset

    fn write_dataset(dataset : Dataset, options? : WriteOptions, limits? : Limits) -> Bytes raise FgbError