Internal: How to read EVF associated *.dbf file in an IDL code
Anonym
At some point in time it may become necessary to read the *.dbf file associated with an ENVI vector file (*.evf). The following article will show how this can be done programmatically.
What you can do is fake IDL into thinking that there is a shapefile associated with your *.dbf file by calling the *.dbf with the *.shp extension. IDL will think there is a shapefile by that name but because you have the /DBF_ONLY keyword set it will only look at that. Here is an example program and a sample *.dbf you can test with:
; ****************************
pro read_dbf_file
filename= 'C:\Temp\my_test.shp'
myshape=OBJ_NEW('IDLffShape', filename, /update, /dbf_only)
help, myshape, /struct
print, myshape
; Get the info for all attribute.
myshape->GetProperty, ATTRIBUTE_INFO=attr_info
; Print Attribute Info.
PRINT, 'Attribute Number: ', '1'
PRINT, 'Attribute Name: ', attr_info[1].name
PRINT, 'Attribute Type: ', attr_info[1].type
PRINT, 'Attribute Width: ', attr_info[1].width
PRINT, 'Attribute Precision: ', attr_info[1].precision
; Close the Shapefile.
OBJ_DESTROY, myshape
END
; ****************************