Struct gdal::vector::Layer

source ·
pub struct Layer<'a> { /* 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.layer(0).unwrap();
for feature in layer.features() {
    // do something with each feature
}

Trait Implementations§

source§

impl<'a> Debug for Layer<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> LayerAccess for Layer<'a>

source§

unsafe fn c_layer(&self) -> OGRLayerH

Returns the C wrapped pointer Read more
source§

fn defn(&self) -> &Defn

source§

fn feature(&self, fid: u64) -> Option<Feature<'_>>

Returns the feature with the given feature id fid, or None if not found. Read more
source§

fn features(&mut self) -> FeatureIterator<'_>

Returns iterator over the features in this layer. Read more
source§

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)

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 )

Set a spatial rectangle filter on this layer by specifying the bounds of a rectangle.
source§

fn clear_spatial_filter(&mut self)

Clear spatial filters set on this layer.
source§

fn name(&self) -> String

Get the name of this layer.
source§

fn has_capability(&self, capability: LayerCaps) -> bool

source§

fn create_defn_fields(&self, fields_def: &[(&str, Type)]) -> Result<()>

source§

fn create_feature(&mut self, geometry: Geometry) -> Result<()>

source§

fn create_feature_fields( &mut self, geometry: Geometry, field_names: &[&str], values: &[FieldValue] ) -> Result<()>

source§

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>

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>

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>>

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>

Get the spatial reference system for this layer. Read more
source§

fn reset_feature_reading(&mut self)

source§

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)

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<()>

Read batches of columnar Arrow data from OGR. Read more
source§

impl<'a> Metadata for Layer<'a>

source§

fn description(&self) -> Result<String>

For most crate::Datasets, method returns this is the originating filename. For crate::raster::RasterBands it is a description (if supported) or "". Read more
source§

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 Datasets you may come across the domains SUBDATASETS, IMAGE_STRUCTURE, RPC, IMAGERY, xml:, etc. Read more
source§

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 more
source§

fn metadata_item(&self, key: &str, domain: &str) -> Option<String>

Get a single metadata entry, as indicated by key and domain. Read more
source§

fn set_metadata_item( &mut self, key: &str, value: &str, domain: &str ) -> Result<()>

Set a metadata item in given domain at given key. Read more
source§

fn set_description(&mut self, description: &str) -> Result<()>

For Datasets this sets the dataset name; normally application code should not set the “description” for GDALDatasets. For RasterBands it is actually a description (if supported) or "".
source§

fn metadata(&self) -> MetadataIter<'_>where Self: Sized,

Get an iterator over metadata entries, across all domains. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Layer<'a>

§

impl<'a> !Send for Layer<'a>

§

impl<'a> !Sync for Layer<'a>

§

impl<'a> Unpin for Layer<'a>

§

impl<'a> UnwindSafe for Layer<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.