GeomSource

fio.GeomSource(self, file, mode='r', overwrite=False, srs=None)

A source object for geospatial vector data.

Essentially an OGR DataSource wrapper.

Parameters

Name Type Description Default
file str Path to a file. required
mode str The I/O mode. Either r for reading or w for writing. 'r'
overwrite bool Whether or not to overwrite an existing dataset. False
srs str A Spatial reference system string in case the dataset has none. None

Examples

Index the GeomSource directly to get features.

# Load a file
gm = GeomSource(< path-to-file >)

# Index it!
feature = gm[1]

Attributes

Name Description
bounds Return the bounds of the GridSource.
columns Return the columns header of the attribute tabel.
dtypes Return the data types of the fields.
fields Return the names of the fields.
geom_type Return the geometry type.
size Return the size (geometry count).
srs Return the srs (Spatial Reference System).

Methods

Name Description
add_feature Add a feature to the layer.
add_feature_from_defn Add a feature to a layer by using properties from another.
add_feature_with_map Add a feature with extra field data.
close Close the GeomSouce.
copy_layer Copy a layer to an existing dataset.
create Create a data source.
create_field Add a new field.
create_fields Add multiple fields at once.
create_layer Create a new vector layer.
create_layer_from_copy Create a new layer by copying another layer.
flush Flush the data.
reduced_iter Yield items on an interval.
reopen Reopen a closed GeomSource.
set_layer_from_defn Set layer meta from another layer’s meta.
Back to top