diff options
| author | Claude Paroz <claude@2xlibre.net> | 2015-03-12 18:12:11 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-03-13 16:41:37 +0100 |
| commit | f1156945479021410a26067be8f486defc79e19b (patch) | |
| tree | 7ab3b43f0905f79c9e6c31be6539942cd2d7eb10 /docs | |
| parent | 6f555e54f727f49ac1f4982b6e6126f3238746e4 (diff) | |
[1.8.x] Documented gdal DataSource encoding parameter
Thanks Max Demars for the suggestion and Tim Graham for the review.
Backport of a8991b9b9f1 from master.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/gis/gdal.txt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt index 2ed65746c9..88e601523d 100644 --- a/docs/ref/contrib/gis/gdal.txt +++ b/docs/ref/contrib/gis/gdal.txt @@ -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 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 file you want to read. However, OGR + The constructor for ``DataSource`` only requires one parameter: the path of + the file you want to read. However, OGR also supports a variety of more complex data sources, including databases, that may be accessed by passing a special name string instead 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 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 layers of data it contains by accessing the :attr:`layer_count` property, or (equivalently) by using the ``len()`` function. For information on |
