OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.65k stars 2.46k forks source link

Writing Extended Entity Data stored in RawCodeValues back to DXF #9472

Open cxcandid opened 3 months ago

cxcandid commented 3 months ago

Feature description

When we use ogr2ogr to convert a DXF file to a format that natively supports StringList type for field RawCodeValues (i.e. GeoJSON) , we can export all AutoCAD Extended Entity Data (EED), if we set --config option DXF_INCLUDE_RAW_CODE_VALUES=TRUE. Unfortunately, the reverse does not work. We cannot write EED that is stored in RawCodeValues back to DXF.

I guess, it shouldn't be too difficult to write this data back.

Additional context

No response

rouault commented 3 months ago

CC @atlight

atlight commented 3 months ago

This would be reasonably straightforward to add. You would write a function to OGRDXFWriterLayer that is called from each of the Write* functions. The new function would validate the RawCodeValues list (ensure it has an even number of values and values at position 0, 2, ... are integers) and writes the entries out to the file line by line.

I'm unlikely to find time to develop this, but it should be straightforward enough for anyone with basic C++ knowledge. The only GDAL-specific thing is iterating through the StringList. I'd be glad to review a pull request.

cxcandid commented 3 months ago

A small note on RawCodeValues validation. There is a mandatory application name (code 1001) that has to be registered in the AppID section of the DXF. Extended Entity Data is limited to 16K per entity. And there are multiple group codes for different data types (i.e. String, Int, Real). More info here: https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-A94BC605-5517-437F-A6FE-D3EB8116A01A