I am in process of finalising a piece of code in Ruby to convert geometries to DXF. While I was able to code the conversion logic, I am unable to close the DXF file. I tried driver.delete_data_source but does not work. There are no methods like close, destroy, flush on classes Gdal::Ogr::DataSource or Gdal::Ogr::Driver.
Can you please guide me what methods I should call for the final DXF to be flushed and closed?
Hi,
I am in process of finalising a piece of code in Ruby to convert geometries to DXF. While I was able to code the conversion logic, I am unable to close the DXF file. I tried driver.delete_data_source but does not work. There are no methods like close, destroy, flush on classes Gdal::Ogr::DataSource or Gdal::Ogr::Driver.
Can you please guide me what methods I should call for the final DXF to be flushed and closed?
Thank you.
Below is the basic code:
Create a new DXF driver
driver = Gdal::Ogr.get_driver_by_name("DXF")
Create a new DXF file
dxf_file = driver.create_data_source("my_file.dxf")
create layer and process geometries
Create a new layer in the DXF file
layer_dxf = dxf_file.create_layer("my_layer" ...
process geometries and added them to DXF
layer_dxf.sync_to_disk
TODO close the file