[gdal-dev] Reading an IntegerList from file
Bruno Belarte
bruno.belarte at gmail.com
Thu Sep 20 01:23:34 PDT 2012
Hi,
Thank you for your answer.
Le 19/09/2012 17:04, Even Rouault a écrit :
> Because KML, GML and SQLite driver have a default case where they will create a
> field of String type when encountering an unhandled field type such as
> IntegerList, whereas the Shapefile driver will refuse it directly. For those
> drivers that consider an IntegerList as a String, they will serialize it's
> content as "{N:v1,v2,...,vn}", and potentially truncated if that serialized
> content goes above 80 characters.
Is it possible to keep the full string and not the truncated one ? Maybe
a parameter to set ?
> Yes, when reading back those files, the field is presumably of String type, so
> GetFieldAsIntegerList() returns NULL. But GetFieldAsString() should return the
> serialized content in the "{N:v1,v2,...,vn}" format.
>
> You can confirm that easily by using ogrinfo.
Yes, I can access the field as a string. So I just need to parse it to
do what I want and the job will be done.
> Very few drivers fully support round-tripping of IntegerList, RealList
> of StringList types. AFAIR, PostgreSQL is one of them, but that must
> be about it. The GML driver supports it in read mode, but not in write
> mode (although that could probably be improved)
For now I have tested a few drivers :
- KML : useless with the default driver (unable to read the extended
data). Solution : use the libkml (from google)
- Shapefile : unable to write IntegerList
- GML : as you said the driver doesn't support IntegerList in write mode
- SQLite : works fine, the only drawback is that this driver is a lot
slower than the others
From now I will use the SQLite driver as the performance in write mode
is not an issue for me.
Bruno Belarte
More information about the gdal-dev
mailing list