Documented gdal DataSource encoding parameter
Thanks Max Demars for the suggestion and Tim Graham for the review.
This commit is contained in:
parent
f6b09a7f85
commit
a8991b9b9f
|
@ -55,10 +55,10 @@ points, polygons, etc.), as well as the names and types of any
|
||||||
additional fields (:class:`Field`) of data that may be associated with
|
additional fields (:class:`Field`) of data that may be associated with
|
||||||
each feature in that layer.
|
each feature in that layer.
|
||||||
|
|
||||||
.. class:: DataSource(ds_input)
|
.. class:: DataSource(ds_input, [encoding='utf-8'])
|
||||||
|
|
||||||
The constructor for ``DataSource`` just a single parameter: the path of
|
The constructor for ``DataSource`` only requires one parameter: the path of
|
||||||
the file you want to read. However, OGR
|
the file you want to read. However, OGR
|
||||||
also supports a variety of more complex data sources, including
|
also supports a variety of more complex data sources, including
|
||||||
databases, that may be accessed by passing a special name string instead
|
databases, that may be accessed by passing a special name string instead
|
||||||
of a path. For more information, see the `OGR Vector Formats`__
|
of a path. For more information, see the `OGR Vector Formats`__
|
||||||
|
@ -66,6 +66,11 @@ each feature in that layer.
|
||||||
instance gives the OGR name of the underlying data source that it is
|
instance gives the OGR name of the underlying data source that it is
|
||||||
using.
|
using.
|
||||||
|
|
||||||
|
The optional ``encoding`` parameter allows you to
|
||||||
|
specify a non-standard encoding of the strings in the source. This is
|
||||||
|
typically useful when you obtain ``DjangoUnicodeDecodeError`` exceptions
|
||||||
|
while reading field values.
|
||||||
|
|
||||||
Once you've created your ``DataSource``, you can find out how many
|
Once you've created your ``DataSource``, you can find out how many
|
||||||
layers of data it contains by accessing the :attr:`layer_count` property,
|
layers of data it contains by accessing the :attr:`layer_count` property,
|
||||||
or (equivalently) by using the ``len()`` function. For information on
|
or (equivalently) by using the ``len()`` function. For information on
|
||||||
|
|
Loading…
Reference in New Issue