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> LayerAccess for Layer<'a>
impl<'a> LayerAccess for Layer<'a>
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<'a> Metadata for Layer<'a>
impl<'a> Metadata for Layer<'a>
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 moreAuto 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> 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