Monday, 13 June 2016

How to read Arc/Info e00 vector files (no binaries) with Python?



I can easily read e00 files with QGIS and it seems as if in older versions of ogr there was driver support for the arc/info e00 file format. Nowadays that seems to be deprecated, as running ogrinfo --formats doesn't list arc/info.


I also found this useful link, a general description of the file format. Based on that information I would be able to write my own program to put all the pieces together. But hey, this must have been done before, right?


Can somebody point me into the right direction?



Answer



For completeness sake.


acr_file = r'../xxx.e00' 
dr = ogr.GetDriverByName("AVCE00")
f = dr.Open(arc_file)

In my case, if I do a layer count I will get 2 because the e00-file contains polylines and -points.



f.GetLayerCount()
>>> 2

Lines are always named 'ARC', whereas points are named 'LAB'. So


lyr_arc = f.GetLayerByName('ARC')
lyr_arc.GetFeatureCount()
>>> 476562

will give you access to the polylines part and


lyr_lab = f.GetLayerByName('LAB')

lyr_lab.GetFeatureCount()
>>> 62882

to the points part of the file.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...