Using OGR in Python, I'd like to create some geometries within a DXF file, but not in the "0" layer, but in new ones.
I tried with:
import ogr, os, osr, sys ds = ogr.GetDriverByName('DXF').CreateDataSource('output.dxf' ) myLayer = ds.CreateLayer('entities') newFeature = ogr.Feature(feature_def = myLayer.GetLayerDefn()) newFeature.SetGeometryDirectly(ogr.CreateGeometryFromWkt( 'LINESTRING(0 0, 100 100)')) myLayer.CreateFeature( newFeature ) newFeature.Destroy() ds.Destroy() ds = None
But I don't have any idea about how to continue and create new layers.
I tried also with
layers = ds.ExecuteSQL("INSERT INTO entities (Layer) VALUES ('Layer1')")
but it does not work.
- Any suggestion?
- Is it worth using another DXF+Python library?
Thank you very much.