<div dir="ltr"><div>Hello everyone.</div><div><br></div><div>Same layer new problem when I try to get value stored in my feature my binary value (transformed to hex value) is truncated to 75 char maximum.</div><div>I tried to add the 'SetWidth' variable when creating the field, but it doesn't change anything.</div><div><br></div><div><pre style="background-color:rgb(64,64,64);color:rgb(155,194,142);font-family:"Ubuntu Mono",monospace"><span style="color:rgb(204,153,0);font-weight:bold">from </span>osgeo <span style="color:rgb(204,153,0);font-weight:bold">import </span>ogr<br><br><span style="color:rgb(255,102,102)"># create layer<br></span>driver <span style="color:rgb(255,255,255);font-weight:bold">= </span>ogr.GetDriverByName<span style="font-weight:bold">(</span><span style="color:rgb(0,181,128);font-weight:bold">'Memory'</span><span style="font-weight:bold">)<br></span>data_source <span style="color:rgb(255,255,255);font-weight:bold">= </span>driver.CreateDataSource<span style="font-weight:bold">(</span><span style="color:rgb(0,181,128);font-weight:bold">'foo'</span><span style="font-weight:bold">)<br></span>layer <span style="color:rgb(255,255,255);font-weight:bold">= </span>data_source.CreateLayer<span style="font-weight:bold">(</span><span style="color:rgb(0,181,128);font-weight:bold">'bar'</span><span style="font-weight:bold">)<br></span><span style="font-weight:bold"><br></span><span style="color:rgb(255,102,102)"># create binary field<br></span>field_name <span style="color:rgb(255,255,255);font-weight:bold">= </span><span style="color:rgb(0,181,128);font-weight:bold">'bin_field'<br></span>binary_field <span style="color:rgb(255,255,255);font-weight:bold">= </span>ogr.FieldDefn<span style="font-weight:bold">(</span>field_name<span style="color:rgb(204,120,50)">, </span>ogr.OFTBinary<span style="font-weight:bold">)<br></span>layer.CreateField<span style="font-weight:bold">(</span>binary_field<span style="font-weight:bold">)<br></span><span style="font-weight:bold"><br></span><span style="color:rgb(255,102,102)"># add feature that contains binary value<br></span>bytes_value <span style="color:rgb(255,255,255);font-weight:bold">= </span><span style="color:rgb(0,204,204)">bytes</span><span style="font-weight:bold">(</span><span style="color:rgb(133,205,0);font-weight:bold">b'</span><span style="color:rgb(0,255,0);font-weight:bold">\x0e</span><span style="color:rgb(133,205,0);font-weight:bold">=p</span><span style="color:rgb(0,255,0);font-weight:bold">\xa3\xd7\n</span><span style="color:rgb(133,205,0);font-weight:bold">=@"</span><span style="color:rgb(0,255,0);font-weight:bold">\x8f\\</span><span style="color:rgb(133,205,0);font-weight:bold">(</span><span style="color:rgb(0,255,0);font-weight:bold">\xf5\xc2\x8f\xc0</span><span style="color:rgb(133,205,0);font-weight:bold">`]</span><span style="color:rgb(0,255,0);font-weight:bold">\x1e\xb8</span><span style="color:rgb(133,205,0);font-weight:bold">Q</span><span style="color:rgb(0,255,0);font-weight:bold">\xeb\x85</span><span style="color:rgb(133,205,0);font-weight:bold">?</span><span style="color:rgb(0,255,0);font-weight:bold">\xf8</span><span style="color:rgb(133,205,0);font-weight:bold">Q</span><span style="color:rgb(0,255,0);font-weight:bold">\xeb\x85\x1e\xb8</span><span style="color:rgb(133,205,0);font-weight:bold">R@A</span><span style="color:rgb(0,255,0);font-weight:bold">\x8f\\</span><span style="color:rgb(133,205,0);font-weight:bold">(</span><span style="color:rgb(0,255,0);font-weight:bold">\xf5\xc2\x8f</span><span style="color:rgb(133,205,0);font-weight:bold">@R</span><span style="color:rgb(0,255,0);font-weight:bold">\x0e\xf9\xdb</span><span style="color:rgb(133,205,0);font-weight:bold">"</span><span style="color:rgb(0,255,0);font-weight:bold">\xd0\xe5</span><span style="color:rgb(133,205,0);font-weight:bold">@</span><span style="color:rgb(0,255,0);font-weight:bold">\x0e</span><span style="color:rgb(133,205,0);font-weight:bold">=p</span><span style="color:rgb(0,255,0);font-weight:bold">\xa3\xd7\n</span><span style="color:rgb(133,205,0);font-weight:bold">=@"</span><span style="color:rgb(0,255,0);font-weight:bold">\x8f\\</span><span style="color:rgb(133,205,0);font-weight:bold">(</span><span style="color:rgb(0,255,0);font-weight:bold">\xf5\xc2\x8f\x00\x00\x00\x01\x00\x00\x00\x04</span><span style="color:rgb(133,205,0);font-weight:bold">@7.</span><span style="color:rgb(0,255,0);font-weight:bold">\x14</span><span style="color:rgb(133,205,0);font-weight:bold">z</span><span style="color:rgb(0,255,0);font-weight:bold">\xe1</span><span style="color:rgb(133,205,0);font-weight:bold">G</span><span style="color:rgb(0,255,0);font-weight:bold">\xae\xc0</span><span style="color:rgb(133,205,0);font-weight:bold">A%</span><span style="color:rgb(0,255,0);font-weight:bold">\x1e\xb8</span><span style="color:rgb(133,205,0);font-weight:bold">Q</span><span style="color:rgb(0,255,0);font-weight:bold">\xeb\x85\xbf\xf4\xf5\xc2\x8f\\</span><span style="color:rgb(133,205,0);font-weight:bold">(</span><span style="color:rgb(0,255,0);font-weight:bold">\xf6\xc0\x12</span><span style="color:rgb(133,205,0);font-weight:bold">p</span><span style="color:rgb(0,255,0);font-weight:bold">\xa3\xd7\n</span><span style="color:rgb(133,205,0);font-weight:bold">=q@</span><span style="color:rgb(0,255,0);font-weight:bold">\x0b</span><span style="color:rgb(133,205,0);font-weight:bold">G</span><span style="color:rgb(0,255,0);font-weight:bold">\xae\x14</span><span style="color:rgb(133,205,0);font-weight:bold">z</span><span style="color:rgb(0,255,0);font-weight:bold">\xe1</span><span style="color:rgb(133,205,0);font-weight:bold">H@Sz=p</span><span style="color:rgb(0,255,0);font-weight:bold">\xa3\xd7\n</span><span style="color:rgb(133,205,0);font-weight:bold">@7.</span><span style="color:rgb(0,255,0);font-weight:bold">\x14</span><span style="color:rgb(133,205,0);font-weight:bold">z</span><span style="color:rgb(0,255,0);font-weight:bold">\xe1</span><span style="color:rgb(133,205,0);font-weight:bold">G</span><span style="color:rgb(0,255,0);font-weight:bold">\xae\xc0</span><span style="color:rgb(133,205,0);font-weight:bold">A%</span><span style="color:rgb(0,255,0);font-weight:bold">\x1e\xb8</span><span style="color:rgb(133,205,0);font-weight:bold">Q</span><span style="color:rgb(0,255,0);font-weight:bold">\xeb\x85</span><span style="color:rgb(133,205,0);font-weight:bold">'</span><span style="font-weight:bold">)<br></span>binary_as_hex_string <span style="color:rgb(255,255,255);font-weight:bold">= </span>bytes_value.hex<span style="font-weight:bold">()<br></span>feature <span style="color:rgb(255,255,255);font-weight:bold">= </span>ogr.Feature<span style="font-weight:bold">(</span>layer.GetLayerDefn<span style="font-weight:bold">())<br></span>feature.SetFieldBinaryFromHexString<span style="font-weight:bold">(</span>field_name<span style="color:rgb(204,120,50)">, </span>binary_as_hex_string<span style="font-weight:bold">)<br></span>layer.CreateFeature<span style="font-weight:bold">(</span>feature<span style="font-weight:bold">)<br></span><span style="font-weight:bold"><br></span><span style="color:rgb(255,102,102)"># get new feature in layer to read it<br></span>read_feature <span style="color:rgb(255,255,255);font-weight:bold">= </span>layer.GetFeature<span style="font-weight:bold">(</span><span style="color:rgb(249,113,187)">0</span><span style="font-weight:bold">)<br></span><span style="color:rgb(255,102,102)"># get 'bin_field' field value<br></span><span style="color:rgb(0,204,204)">print</span><span style="font-weight:bold">(</span>read_feature.GetField<span style="font-weight:bold">(</span>field_name<span style="font-weight:bold">))<br><br>>>> "0E3D70A3D70A3D40228F5C28F5C28FC0605D1EB851EB853FF851EB851EB85240418F5C28..."</span></pre></div><div><br></div><div>Any idea to get the entire value ? <br></div><div><br></div><div>This should return this value normally : 0e3d70a3d70a3d40228f5c28f5c28fc0605d1eb851eb853ff851eb851eb85240418f5c28f5c28f40520ef9db22d0e5400e3d70a3d70a3d40228f5c28f5c28f000000010000000440372e147ae147aec041251eb851eb85bff4f5c28f5c28f6c01270a3d70a3d71400b47ae147ae14840537a3d70a3d70a40372e147ae147aec041251eb851eb85</div><div><div><br>-- <br><div dir="ltr" data-smartmail="gmail_signature">Guilhain AVERLANT<br>119 rue Manin<br>75019 PARIS<br>06 28 22 83 05</div></div></div></div>