Struct gdal::vector::OwnedLayer
source · pub struct OwnedLayer { /* private fields */ }
Expand description
Layer in a vector dataset
use std::path::Path;
use gdal::Dataset;
use gdal::vector::LayerAccess;
let dataset = Dataset::open(Path::new("fixtures/roads.geojson")).unwrap();
let mut layer = dataset.into_layer(0).unwrap();
for feature in layer.features() {
// do something with each feature
}
Implementations§
source§impl OwnedLayer
impl OwnedLayer
sourcepub fn owned_features(self) -> OwnedFeatureIterator ⓘ
pub fn owned_features(self) -> OwnedFeatureIterator ⓘ
Returns iterator over the features in this layer.
Note. This method resets the current index to the beginning before iteration. It also borrows the layer mutably, preventing any overlapping borrows.
sourcepub fn into_dataset(self) -> Dataset
pub fn into_dataset(self) -> Dataset
Returns the Dataset
this layer belongs to and consumes this layer.
Trait Implementations§
source§impl Debug for OwnedLayer
impl Debug for OwnedLayer
source§impl From<OwnedFeatureIterator> for OwnedLayer
impl From<OwnedFeatureIterator> for OwnedLayer
source§fn from(feature_iterator: OwnedFeatureIterator) -> Self
fn from(feature_iterator: OwnedFeatureIterator) -> Self
Converts to this type from the input type.
source§impl From<OwnedLayer> for Dataset
impl From<OwnedLayer> for Dataset
source§fn from(owned_layer: OwnedLayer) -> Self
fn from(owned_layer: OwnedLayer) -> Self
Converts to this type from the input type.
source§impl LayerAccess for OwnedLayer
impl LayerAccess for OwnedLayer
fn defn(&self) -> &Defn
source§fn features(&mut self) -> FeatureIterator<'_> ⓘ
fn features(&mut self) -> FeatureIterator<'_> ⓘ
Returns iterator over the features in this layer. Read more
source§fn set_feature(&self, feature: Feature<'_>) -> Result<()>
fn set_feature(&self, feature: Feature<'_>) -> Result<()>
Set a feature on this layer layer. Read more
source§fn set_spatial_filter(&mut self, geometry: &Geometry)
fn set_spatial_filter(&mut self, geometry: &Geometry)
Set a spatial filter on this layer. Read more
source§fn set_spatial_filter_rect(
&mut self,
min_x: f64,
min_y: f64,
max_x: f64,
max_y: f64
)
fn set_spatial_filter_rect( &mut self, min_x: f64, min_y: f64, max_x: f64, max_y: f64 )
Set a spatial rectangle filter on this layer by specifying the bounds of a rectangle.
source§fn clear_spatial_filter(&mut self)
fn clear_spatial_filter(&mut self)
Clear spatial filters set on this layer.
fn has_capability(&self, capability: LayerCaps) -> bool
fn create_defn_fields(&self, fields_def: &[(&str, Type)]) -> Result<()>
fn create_feature(&mut self, geometry: Geometry) -> Result<()>
fn create_feature_fields( &mut self, geometry: Geometry, field_names: &[&str], values: &[FieldValue] ) -> Result<()>
source§fn feature_count(&self) -> u64
fn feature_count(&self) -> u64
Returns the number of features in this layer, even if it requires expensive calculation. Read more
source§fn try_feature_count(&self) -> Option<u64>
fn try_feature_count(&self) -> Option<u64>
Returns the number of features in this layer, if it is possible to compute this
efficiently. Read more
source§fn get_extent(&self) -> Result<Envelope>
fn get_extent(&self) -> Result<Envelope>
Returns the extent of this layer as an axis-aligned bounding box, even if it requires
expensive calculation. Read more
source§fn try_get_extent(&self) -> Result<Option<Envelope>>
fn try_get_extent(&self) -> Result<Option<Envelope>>
Returns the extent of this layer as an axis-aligned bounding box, if it is possible to
compute this efficiently. Read more
source§fn spatial_ref(&self) -> Option<SpatialRef>
fn spatial_ref(&self) -> Option<SpatialRef>
Get the spatial reference system for this layer. Read more
fn reset_feature_reading(&mut self)
source§fn set_attribute_filter(&mut self, query: &str) -> Result<()>
fn set_attribute_filter(&mut self, query: &str) -> Result<()>
Set a new attribute query that restricts features when using the feature iterator. Read more
source§fn clear_attribute_filter(&mut self)
fn clear_attribute_filter(&mut self)
Clear the attribute filter set on this layer Read more
source§unsafe fn read_arrow_stream(
&mut self,
out_stream: *mut ArrowArrayStream,
options: &CslStringList
) -> Result<()>
unsafe fn read_arrow_stream( &mut self, out_stream: *mut ArrowArrayStream, options: &CslStringList ) -> Result<()>
source§impl Metadata for OwnedLayer
impl Metadata for OwnedLayer
source§fn description(&self) -> Result<String>
fn description(&self) -> Result<String>
For most
crate::Dataset
s, method returns this is the originating filename.
For crate::raster::RasterBand
s it is a description (if supported) or ""
. Read moresource§fn metadata_domains(&self) -> Vec<String>
fn metadata_domains(&self) -> Vec<String>
Metadata in GDAL is partitioned into namespaces, knows as “domains” in the
GDAL Data Model.
GDAL types with metadata (a.k.a. “Major Objects”) have a default or “root” domain
identified by the empty string (
""
).
Specific “Major Object” types may have other conventionally recognized domains.
For example, in raster Dataset
s you may come across the domains
SUBDATASETS
, IMAGE_STRUCTURE
, RPC
, IMAGERY
, xml:
, etc. Read moresource§fn metadata_domain(&self, domain: &str) -> Option<Vec<String>>
fn metadata_domain(&self, domain: &str) -> Option<Vec<String>>
Get all the metadata values within the given
domain
. Returns None
if
domain is not defined.
Entries in the returned Vec<String>
are formatted as “Name=value” pairs Read moreimpl Send for OwnedLayer
As long we have a 1:1 mapping between a dataset and a layer, it is Send
.
We cannot allow a layer to be send, when two or more access (and modify) the same Dataset
.
Auto Trait Implementations§
impl RefUnwindSafe for OwnedLayer
impl !Sync for OwnedLayer
impl Unpin for OwnedLayer
impl UnwindSafe for OwnedLayer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more