Menu

#170 io_shapes - "Export Shapes to XYZ" exports only the first character of strings

v2.1.0
closed
nobody
None
1
2013-11-08
2013-10-24
Sh4pe
No

Hi!

When exporting a shape to a .xyz-file using io_shapes - "Export Shapes to XYZ", only the first first character of every string is written into the target .xyz-file. This is true for both the header and for every attribute.

So basically, I'm talking about the code in "src/modules_io/shapes/io_shapes/xyz.cpp".

In my application, I needed the complete strings. I fixed the problem by rewriting the module. I implemented my replacement differently than the original implementation:

  • Instead of writing with fprintf to a file opened by fopen, I used a std::ofstream
  • In the case of the header, I wrote the result of Get_Field_Name( iField ).b_str() to the stream using its operator<< (rather than just Get_Field_Name( iField ))
  • In the case of attributes that are strings, I also wrote result of Get_Field_Name( iField ).b_str() to the stream using its operator<< (rather than just Get_Field_Name( iField ))

I'm not sure which one of these changes fixed the problem, but in combination it works perfectly.

It might also be interesting that my SAGA-GIS (the one I loaded my compiled module into) is the standard 64 bit version (2.1.0) available for download (with unicode strings)

Discussion

  • Volker Wichmann

    Volker Wichmann - 2013-11-08
    • status: open --> closed
     
  • Volker Wichmann

    Volker Wichmann - 2013-11-08

    Hi,

    thanks for reporting. This should be fixed in r1869 in r1874, see

    io_shapes, export to xyz: should fix bug #170 'Export Shapes to XYZ exports only the first character of strings' http://sourceforge.net/p/saga-gis/code-0/1869/

    Export Shapes to XYZ: do not use Stream.Write because of unicode incompatibility, completes r1869 http://sourceforge.net/p/saga-gis/code-0/1874/

     

Anonymous
Anonymous

Add attachments
Cancel