

These objects are also returned from theįeature.geom attribute, when reading vector data from Instantiated directly from the given geom_input parameter, which may beĪ string containing WKT, HEX, GeoJSON, a buffer containing WKB data, orĪn OGRGeomType object. This object is a wrapper for the OGR Geometry class. > from import OGRGeometry > polygon = OGRGeometry ( 'POLYGON((0 0, 5 0, 5 5, 0 5))' ) class OGRGeometry( geom_input, srs=None) ¶

For information onĪccessing the layers of data themselves, see the next section: (equivalently) by using the len() function. Of data it contains by accessing the layer_count property, or Once you’ve created your DataSource, you can find out how many layers Obtain DjangoUnicodeDecodeError exceptions while reading field values. The optional encoding parameter allows you to specify a non-standardĮncoding of the strings in the source. The name property of aĭataSource instance gives the OGR name of the underlying data source However, OGR also supports a variety of moreĬomplex data sources, including databases, that may be accessed by passingĪ special name string instead of a path. The constructor for DataSource only requires one parameter: the path of class DataSource( ds_input, encoding='utf-8') ¶ Points, polygons, etc.), as well as the names and types of anyĪdditional fields ( Field) of data that may be associated withĮach feature in that layer. Information about the type of features contained in that layer (e.g.

Object, contains some number of geographic features ( Feature), Eachĭata source is represented by a DataSource object which contains Supports reading data from a variety of OGR-supported geospatial fileįormats and data sources using a consistent interface. DataSource is a wrapper for the OGR data source object that
