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 os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from multiprocessing import Pool
|
|
||||||
|
|
||||||
csv.field_size_limit(sys.maxsize)
|
csv.field_size_limit(sys.maxsize)
|
||||||
|
|
||||||
@ -20,19 +19,18 @@ def main(mastermap_path):
|
|||||||
|
|
||||||
def filter(mm_path)
|
def filter(mm_path)
|
||||||
output_path = "{}.filtered.csv".format(str(mm_path).replace(".gml.csv", ""))
|
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')
|
output_fieldnames = ('WKT', 'fid', 'descriptiveGroup')
|
||||||
|
# Open the input csv with all polygons, buildings and others
|
||||||
with open(mm_path, 'r') as fh:
|
with open(mm_path, 'r') as fh:
|
||||||
r = csv.DictReader(fh)
|
r = csv.DictReader(fh)
|
||||||
|
# Open a new buildings csv
|
||||||
with open(output_path, 'w') as output_fh:
|
with open(output_path, 'w') as output_fh:
|
||||||
w = csv.DictWriter(output_fh, fieldnames=output_fieldnames)
|
w = csv.DictWriter(output_fh, fieldnames=output_fieldnames)
|
||||||
w.writeheader()
|
w.writeheader()
|
||||||
with open(alt_output_path, 'w') as alt_output_fh:
|
# Then write to the output csv buildings only
|
||||||
alt_w = csv.DictWriter(alt_output_fh, fieldnames=output_fieldnames)
|
for line in r:
|
||||||
alt_w.writeheader()
|
if 'Building' in line['descriptiveGroup']:
|
||||||
for line in r:
|
w.writerow(line)
|
||||||
if 'Building' in line['descriptiveGroup']:
|
|
||||||
w.writerow(line)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user