I'm using Python to extract the layers of a DXF file and convert them into SHP.

I began with:

------------------------
import ogr, os, sys
driver = ogr.GetDriverByName('DXF')
datasource = driver.Open('test1.dxf', 0)
numberLayers = datasource.GetLayerCount()
for i in range(0, numberLayers):
    layer = datasource.GetLayerByIndex(i)
    layerName = layer.GetName()
    numberFeatures = layer.GetFeatureCount()
    print 'Layer=%s|Features=%s' % (layerName, numberFeatures)
but I get one only layer: entities (as expected:
http://www.gdal.org/ogr/drv_dxf.html)
----------------

Obviously, it's the same information as if I execute: ogrinfo -so
test1.dxf entities

My DXF file contains several CAD layers: "ROADS", "ELEVATION", ... Is
it possible to handle these layer names with OGR? Thank you very much.
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to