pub struct FgbWriter<'a> { /* private fields */ }
Expand description

FlatGeobuf dataset writer

Usage example:

use flatgeobuf::*;
use geozero::geojson::GeoJsonReader;
use geozero::GeozeroDatasource;

let mut fgb = FgbWriter::create("countries", GeometryType::MultiPolygon)?;
let mut fin = BufReader::new(File::open("countries.geojson")?);
let mut reader = GeoJsonReader(&mut fin);
reader.process(&mut fgb)?;
let mut fout = BufWriter::new(File::create("countries.fgb")?);
fgb.write(&mut fout)?;

Implementations

Configure FlatGeobuf headers for creating a new file with default options

Usage example:
let mut fgb = FgbWriter::create("countries", GeometryType::MultiPolygon).unwrap();

Configure FlatGeobuf headers for creating a new file

Usage example:
let mut fgb = FgbWriter::create_with_options(
    "countries",
    GeometryType::MultiPolygon,
    FgbWriterOptions {
        description: Some("Country polygons"),
        write_index: false,
        crs: FgbCrs {
            code: 4326,
            ..Default::default()
        },
        ..Default::default()
    },
)
.unwrap();

Add a new column.

Usage example:
fgb.add_column("fid", ColumnType::ULong, |_fbb, col| {
    col.nullable = false;
});

Add a new feature.

Usage example:
use geozero::geojson::GeoJson;
let geojson = GeoJson(r#"{"type": "Feature", "properties": {"fid": 42, "name": "New Zealand"}, "geometry": {"type": "Point", "coordinates": [1, 1]}}"#);
fgb.add_feature(geojson).ok();

Add a new feature from a GeozeroGeometry.

Usage example:
use geozero::geojson::GeoJson;
use geozero::{ColumnValue, PropertyProcessor};
let geom = GeoJson(r#"{"type": "Point", "coordinates": [1, 1]}"#);
fgb.add_feature_geom(geom, |feat| {
    feat.property(0, "fid", &ColumnValue::Long(43)).unwrap();
    feat.property(1, "name", &ColumnValue::String("South Africa"))
        .unwrap();
})
.ok();

Write the FlatGeobuf dataset (Hilbert sorted)

Trait Implementations

End of feature processing

Begin of dataset processing

End of dataset processing

Begin of feature processing

Begin of feature property processing

End of feature property processing

Begin of feature geometry processing

End of feature geometry processing

Process coordinate with x,y dimensions

Process coordinate with all requested dimensions

Begin of Point processing Read more

End of Point processing

Begin of MultiPoint processing Read more

End of MultiPoint processing

Begin of LineString processing Read more

End of LineString processing

Begin of MultiLineString processing Read more

End of MultiLineString processing

Begin of Polygon processing Read more

End of Polygon processing

Begin of MultiPolygon processing Read more

End of MultiPolygon processing

Begin of CircularString processing Read more

End of CircularString processing

Begin of CompoundCurve processing Read more

End of CompoundCurve processing

Begin of CurvePolygon processing Read more

End of CurvePolygon processing

Begin of MultiCurve processing Read more

End of MultiCurve processing

Begin of MultiSurface processing Read more

End of MultiSurface processing

Begin of Triangle processing Read more

End of Triangle processing

Begin of PolyhedralSurface processing Read more

End of PolyhedralSurface processing

Begin of Tin processing Read more

End of Tin processing

Additional dimensions requested when processing coordinates

Request additional dimensions for coordinate processing

SRID of geometries Read more

Process empty coordinates, like WKT’s POINT EMPTY

Begin of GeometryCollection processing

End of GeometryCollection processing

Process property value. Abort processing, if return value is true.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more