FlatGeobuf 2D feature codec, packed spatial index, and bounded random-access queries
moon add moyunijieshi1/moon-flatgeobufimport {
"moyunijieshi1/moon-flatgeobuf" @fgb,
}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,
})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.geojsonmoon 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.pypub suberror FgbError {
InvalidData(Int, String)
Unsupported(String)
LimitExceeded(String)
InvalidArgument(String)
} derive(Debug)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)pub(all) struct Geometry {
kind : GeometryKind
xy : Array[Coordinate]
ends : Array[Int]
parts : Array[Geometry]
} derive(Eq, ToJson, Debug, FromJson)pub struct RangeCache {
capacity : Int
max_entries : Int
validator : String
entries_ : Array[CachedRange]
retained : Int
hits : Int
misses : Int
evictions : Int
}fn RangeCache::put(self : RangeCache, range : ByteRange, bytes : Bytes, etag : String) -> Unit raise FgbErrorpub 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
}pub struct StreamDecoder {
limits : Limits
stage : DecodeStage
buffer : ByteWriter
header_ : Header?
total_received : Int
ordinal : Int
feature_offset : Int
closed : Bool
failed : Bool
}fn write_dataset(dataset : Dataset, options? : WriteOptions, limits? : Limits) -> Bytes raise FgbErrorInstall
Download zipFlatGeobuf 2D feature codec, packed spatial index, and bounded random-access queries