Update 'shp_2_txt.py'

This commit is contained in:
zwnk 2019-05-23 02:35:08 +02:00
parent 669d2ae723
commit 146f5e0161
1 changed files with 8 additions and 0 deletions

View File

@ -16,18 +16,26 @@ Example Output for a complete record of MA.dbf:
('MARKER', 'DE = TRAVERSE STATION DISK'), ('SETTING', '7 = SET IN TOP OF CONCRETE MONUMENT'), ('STAMPING', '204 S')])
'''
# dbfread 4 reading dbf files xD
# https://dbfread.readthedocs.io/en/latest/
from dbfread import DBF
# open dbf file
dbf_file = DBF("f:\\testing\\shp_2_txt\\MA.dbf", load=True, encoding='utf8')
# open txt file
txt_file = open("f:\\testing\\shp_2_txt\\MA.txt", 'w')
# get lat, lon, elip height and ortho height
for idx, record in enumerate(dbf_file):
txt_file.write(str(record['DEC_LON'] + record['DEC_LAT'] + record['ELLIP_HT'] + record['ORTHO_HT']) + '\n')
# write txt file
txt_file.close()
'''
example output: