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
sourceimpl OwnedLayer
impl OwnedLayer
sourcepub fn owned_features(self) -> OwnedFeatureIteratorⓘNotable traits for &'a mut OwnedFeatureIteratorimpl<'a> Iterator for &'a mut OwnedFeatureIteratorwhere
Self: 'a, type Item = Feature<'a>;
pub fn owned_features(self) -> OwnedFeatureIteratorⓘNotable traits for &'a mut OwnedFeatureIteratorimpl<'a> Iterator for &'a mut OwnedFeatureIteratorwhere
Self: 'a, type Item = Feature<'a>;
Self: 'a, type Item = Feature<'a>;
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
sourceimpl Debug for OwnedLayer
impl Debug for OwnedLayer
sourceimpl From<OwnedFeatureIterator> for OwnedLayer
impl From<OwnedFeatureIterator> for OwnedLayer
sourcefn from(feature_iterator: OwnedFeatureIterator) -> Self
fn from(feature_iterator: OwnedFeatureIterator) -> Self
Converts to this type from the input type.
sourceimpl From<OwnedLayer> for Dataset
impl From<OwnedLayer> for Dataset
sourcefn from(owned_layer: OwnedLayer) -> Self
fn from(owned_layer: OwnedLayer) -> Self
Converts to this type from the input type.
sourceimpl LayerAccess for OwnedLayer
impl LayerAccess for OwnedLayer
fn defn(&self) -> &Defn
sourcefn features(&mut self) -> FeatureIterator<'_>ⓘNotable traits for FeatureIterator<'a>impl<'a> Iterator for FeatureIterator<'a> type Item = Feature<'a>;
fn features(&mut self) -> FeatureIterator<'_>ⓘNotable traits for FeatureIterator<'a>impl<'a> Iterator for FeatureIterator<'a> type Item = Feature<'a>;
Returns iterator over the features in this layer. Read more
sourcefn set_feature(&self, feature: Feature<'_>) -> Result<()>
fn set_feature(&self, feature: Feature<'_>) -> Result<()>
Set a feature on this layer layer.
ReferSetFeature Read more
sourcefn set_spatial_filter(&mut self, geometry: &Geometry)
fn set_spatial_filter(&mut self, geometry: &Geometry)
Set a spatial filter on this layer. Read more
sourcefn 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.
sourcefn 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<()>
sourcefn 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
sourcefn 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
sourcefn get_extent(&self) -> Result<OGREnvelope>
fn get_extent(&self) -> Result<OGREnvelope>
Returns the extent of this layer as an axis-aligned bounding box, even if it requires
expensive calculation. Read more
sourcefn try_get_extent(&self) -> Result<Option<OGREnvelope>>
fn try_get_extent(&self) -> Result<Option<OGREnvelope>>
Returns the extent of this layer as an axis-aligned bounding box, if it is possible to
compute this efficiently. Read more
sourcefn spatial_ref(&self) -> Result<SpatialRef>
fn spatial_ref(&self) -> Result<SpatialRef>
Fetch the spatial reference system for this layer. Read more
fn reset_feature_reading(&mut self)
sourcefn 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
sourcefn clear_attribute_filter(&mut self)
fn clear_attribute_filter(&mut self)
Clear the attribute filter set on this layer Read more
sourceimpl Metadata for OwnedLayer
impl Metadata for OwnedLayer
fn description(&self) -> Result<String>
fn metadata_domains(&self) -> Vec<String>
fn metadata_domain(&self, domain: &str) -> Option<Vec<String>>
fn metadata_item(&self, key: &str, domain: &str) -> Option<String>
fn set_metadata_item(&mut self, key: &str, value: &str, domain: &str) -> Result<()>
fn set_description(&mut self, description: &str) -> Result<()>
impl 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more