Struct geoarrow::array::PointBuilder
source · pub struct PointBuilder {
pub coords: CoordBufferBuilder,
pub validity: NullBufferBuilder,
/* private fields */
}
Expand description
The GeoArrow equivalent to Vec<Option<Point>>
: a mutable collection of Points.
Converting an PointBuilder
into a PointArray
is O(1)
.
Fields§
§coords: CoordBufferBuilder
§validity: NullBufferBuilder
Implementations§
source§impl PointBuilder
impl PointBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty PointBuilder
.
pub fn new_with_options( coord_type: CoordType, metadata: Arc<ArrayMetadata> ) -> Self
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new PointBuilder
with a capacity.
sourcepub fn with_capacity_and_options(
capacity: usize,
coord_type: CoordType,
metadata: Arc<ArrayMetadata>
) -> Self
pub fn with_capacity_and_options( capacity: usize, coord_type: CoordType, metadata: Arc<ArrayMetadata> ) -> Self
Creates a new PointBuilder
with a capacity.
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more points to be inserted
in the given Vec<T>
. The collection may reserve more space to
speculatively avoid frequent reallocations. After calling reserve
,
capacity will be greater than or equal to self.len() + additional
.
Does nothing if capacity is already sufficient.
sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for at least additional
more points to
be inserted in the given Vec<T>
. Unlike reserve
, this will not
deliberately over-allocate to speculatively avoid frequent allocations.
After calling reserve_exact
, capacity will be greater than or equal to
self.len() + additional
. Does nothing if the capacity is already
sufficient.
Note that the allocator may give the collection more space than it
requests. Therefore, capacity can not be relied upon to be precisely
minimal. Prefer reserve
if future insertions are expected.
sourcepub fn try_new(
coords: CoordBufferBuilder,
validity: NullBufferBuilder,
metadata: Arc<ArrayMetadata>
) -> Result<Self>
pub fn try_new( coords: CoordBufferBuilder, validity: NullBufferBuilder, metadata: Arc<ArrayMetadata> ) -> Result<Self>
The canonical method to create a PointBuilder
out of its internal components.
Implementation
This function is O(1)
.
Errors
This function errors iff:
- The validity is not
None
and its length is different from the number of geometries
sourcepub fn into_inner(self) -> (CoordBufferBuilder, NullBufferBuilder)
pub fn into_inner(self) -> (CoordBufferBuilder, NullBufferBuilder)
Extract the low-level APIs from the PointBuilder
.
sourcepub fn push_point(&mut self, value: Option<&impl PointTrait<T = f64>>)
pub fn push_point(&mut self, value: Option<&impl PointTrait<T = f64>>)
Add a new point to the end of this array.
sourcepub fn push_empty(&mut self)
pub fn push_empty(&mut self)
Add a valid but empty point to the end of this array.
pub fn push_geometry( &mut self, value: Option<&impl GeometryTrait<T = f64>> ) -> Result<()>
pub fn extend_from_iter<'a>( &mut self, geoms: impl Iterator<Item = Option<&'a (impl PointTrait<T = f64> + 'a)>> )
pub fn from_points<'a>( geoms: impl ExactSizeIterator + Iterator<Item = &'a (impl PointTrait<T = f64> + 'a)>, coord_type: Option<CoordType>, metadata: Arc<ArrayMetadata> ) -> Self
pub fn from_nullable_points<'a>( geoms: impl ExactSizeIterator + Iterator<Item = Option<&'a (impl PointTrait<T = f64> + 'a)>>, coord_type: Option<CoordType>, metadata: Arc<ArrayMetadata> ) -> Self
pub fn finish(self) -> PointArray
Trait Implementations§
source§impl Debug for PointBuilder
impl Debug for PointBuilder
source§impl Default for PointBuilder
impl Default for PointBuilder
source§impl<G: PointTrait<T = f64>> From<&[G]> for PointBuilder
impl<G: PointTrait<T = f64>> From<&[G]> for PointBuilder
source§impl From<PointBuilder> for Arc<dyn Array>
impl From<PointBuilder> for Arc<dyn Array>
source§fn from(arr: PointBuilder) -> Self
fn from(arr: PointBuilder) -> Self
source§impl From<PointBuilder> for PointArray
impl From<PointBuilder> for PointArray
source§fn from(other: PointBuilder) -> Self
fn from(other: PointBuilder) -> Self
source§impl<G: PointTrait<T = f64>> From<Vec<'_, G>> for PointBuilder
impl<G: PointTrait<T = f64>> From<Vec<'_, G>> for PointBuilder
source§impl<G: PointTrait<T = f64>> From<Vec<'_, Option<G>>> for PointBuilder
impl<G: PointTrait<T = f64>> From<Vec<'_, Option<G>>> for PointBuilder
source§impl<G: PointTrait<T = f64>> From<Vec<Option<G>>> for PointBuilder
impl<G: PointTrait<T = f64>> From<Vec<Option<G>>> for PointBuilder
source§impl GeomProcessor for PointBuilder
impl GeomProcessor for PointBuilder
source§fn empty_point(&mut self, idx: usize) -> Result<()>
fn empty_point(&mut self, idx: usize) -> Result<()>
POINT EMPTY
source§fn xy(&mut self, x: f64, y: f64, _idx: usize) -> Result<()>
fn xy(&mut self, x: f64, y: f64, _idx: usize) -> Result<()>
source§fn geometrycollection_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn geometrycollection_begin(&mut self, size: usize, idx: usize) -> Result<()>
GeometryCollection
processingsource§fn circularstring_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn circularstring_begin(&mut self, size: usize, idx: usize) -> Result<()>
CircularString
processing Read moresource§fn compoundcurve_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn compoundcurve_begin(&mut self, size: usize, idx: usize) -> Result<()>
source§fn tin_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn tin_begin(&mut self, size: usize, idx: usize) -> Result<()>
source§fn polygon_begin(&mut self, tagged: bool, size: usize, idx: usize) -> Result<()>
fn polygon_begin(&mut self, tagged: bool, size: usize, idx: usize) -> Result<()>
source§fn triangle_begin(
&mut self,
tagged: bool,
size: usize,
idx: usize
) -> Result<()>
fn triangle_begin( &mut self, tagged: bool, size: usize, idx: usize ) -> Result<()>
source§fn linestring_begin(
&mut self,
tagged: bool,
size: usize,
idx: usize
) -> Result<()>
fn linestring_begin( &mut self, tagged: bool, size: usize, idx: usize ) -> Result<()>
LineString
processing Read moresource§fn multipoint_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn multipoint_begin(&mut self, size: usize, idx: usize) -> Result<()>
source§fn curvepolygon_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn curvepolygon_begin(&mut self, size: usize, idx: usize) -> Result<()>
source§fn multipolygon_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn multipolygon_begin(&mut self, size: usize, idx: usize) -> Result<()>
MultiPolygon
processing Read moresource§fn multisurface_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn multisurface_begin(&mut self, size: usize, idx: usize) -> Result<()>
source§fn multilinestring_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn multilinestring_begin(&mut self, size: usize, idx: usize) -> Result<()>
MultiLineString
processing Read moresource§fn polyhedralsurface_begin(&mut self, size: usize, idx: usize) -> Result<()>
fn polyhedralsurface_begin(&mut self, size: usize, idx: usize) -> Result<()>
source§fn dimensions(&self) -> CoordDimensions
fn dimensions(&self) -> CoordDimensions
source§fn srid(&mut self, srid: Option<i32>) -> Result<(), GeozeroError>
fn srid(&mut self, srid: Option<i32>) -> Result<(), GeozeroError>
source§fn coordinate(
&mut self,
x: f64,
y: f64,
z: Option<f64>,
m: Option<f64>,
t: Option<f64>,
tm: Option<u64>,
idx: usize
) -> Result<(), GeozeroError>
fn coordinate( &mut self, x: f64, y: f64, z: Option<f64>, m: Option<f64>, t: Option<f64>, tm: Option<u64>, idx: usize ) -> Result<(), GeozeroError>
source§fn point_begin(&mut self, idx: usize) -> Result<(), GeozeroError>
fn point_begin(&mut self, idx: usize) -> Result<(), GeozeroError>
source§fn multipoint_end(&mut self, idx: usize) -> Result<(), GeozeroError>
fn multipoint_end(&mut self, idx: usize) -> Result<(), GeozeroError>
source§fn linestring_end(
&mut self,
tagged: bool,
idx: usize
) -> Result<(), GeozeroError>
fn linestring_end( &mut self, tagged: bool, idx: usize ) -> Result<(), GeozeroError>
LineString
processingsource§fn multilinestring_end(&mut self, idx: usize) -> Result<(), GeozeroError>
fn multilinestring_end(&mut self, idx: usize) -> Result<(), GeozeroError>
MultiLineString
processingsource§fn polygon_end(&mut self, tagged: bool, idx: usize) -> Result<(), GeozeroError>
fn polygon_end(&mut self, tagged: bool, idx: usize) -> Result<(), GeozeroError>
source§fn multipolygon_end(&mut self, idx: usize) -> Result<(), GeozeroError>
fn multipolygon_end(&mut self, idx: usize) -> Result<(), GeozeroError>
MultiPolygon
processingsource§fn geometrycollection_end(&mut self, idx: usize) -> Result<(), GeozeroError>
fn geometrycollection_end(&mut self, idx: usize) -> Result<(), GeozeroError>
GeometryCollection
processing