-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_script.py
22 lines (20 loc) · 1005 Bytes
/
process_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import argparse
import geopandas as gpd
from naturalcities import natural_cities
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Calculate Natural Cities\
Polygons')
parser.add_argument('--input', help="Path to input point shapefile.",
default="data/sample.shp")
parser.add_argument('--out_path', help="Path to output",
default="data/output/")
parser.add_argument('--depth', help="Max Number of hierarchical levels",
default=3)
args = parser.parse_args()
original_points = gpd.read_file(args.input)
polygons, lines, points = natural_cities.natural_cities(original_points,
args.depth)
polygons.to_file(os.path.join(args.out_path, 'polygons.shp'))
lines.to_file(os.path.join(args.out_path, 'lines.shp'))
points.to_file(os.path.join(args.out_path, 'points.shp'))