[gdal-dev] OGR python : write binary data in layer
Even Rouault
even.rouault at spatialys.com
Wed Dec 16 13:28:21 PST 2020
Guilhain,
On mercredi 16 décembre 2020 21:52:41 CET Guilhain Averlant wrote:
> I wrote a ticket on gis.stackexchange.combut I didn't get a satisfactory
> answer, so I ask my question here.
>
> I'm trying to create a memory layer with gdal/ogr python that contains a
> Binary Field.
>
> But I didn't succeed, where am I wrong?
Probably nothing. I'm not sure why we don't have an override for this. Perhaps
because OFTBinary is rather exotic and nobody strongly needed it before.
Perhaps some (past) Python2/3 dilemna too
You can use f.SetFieldBinaryFromHexString(field_name,
binary_as_hex_string)
where e.g. binary_as_hex_string = binascii.hexlify(b'hello world')
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list