remove not needed non-buildings toid code
This commit is contained in:
parent
7ec09a7123
commit
103300f969
@ -8,7 +8,6 @@ import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
from multiprocessing import Pool
|
||||
|
||||
csv.field_size_limit(sys.maxsize)
|
||||
|
||||
@ -20,19 +19,18 @@ def main(mastermap_path):
|
||||
|
||||
def filter(mm_path)
|
||||
output_path = "{}.filtered.csv".format(str(mm_path).replace(".gml.csv", ""))
|
||||
alt_output_path = "{}.filtered_not_building.csv".format(str(mm_path).replace(".gml.csv", ""))
|
||||
output_fieldnames = ('WKT', 'fid', 'descriptiveGroup')
|
||||
# Open the input csv with all polygons, buildings and others
|
||||
with open(mm_path, 'r') as fh:
|
||||
r = csv.DictReader(fh)
|
||||
# Open a new buildings csv
|
||||
with open(output_path, 'w') as output_fh:
|
||||
w = csv.DictWriter(output_fh, fieldnames=output_fieldnames)
|
||||
w.writeheader()
|
||||
with open(alt_output_path, 'w') as alt_output_fh:
|
||||
alt_w = csv.DictWriter(alt_output_fh, fieldnames=output_fieldnames)
|
||||
alt_w.writeheader()
|
||||
for line in r:
|
||||
if 'Building' in line['descriptiveGroup']:
|
||||
w.writerow(line)
|
||||
w.writeheader()
|
||||
# Then write to the output csv buildings only
|
||||
for line in r:
|
||||
if 'Building' in line['descriptiveGroup']:
|
||||
w.writerow(line)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user