forked from ungarj/label_centerlines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_centerline.py
executable file
·64 lines (49 loc) · 1.62 KB
/
test_centerline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
import os
from itertools import product
from create_centerlines import run
from pdb import set_trace
START_DIR = "/projects/cmsindo/data/logging/automated_accuracy/test_postprocess"
timberdana_roads = "005/roads_mixed_gtet050_dissolve_multiparts_idsep.shp"
timberdana_trails = "005/skidtrails_mixed_lt050_dissolve_multiparts_idsep.shp"
rodamas_roads = "008/roads_mixed_gtet050_dissolve_multiparts_idsep.shp"
rodamas_trails = "008/skidtrails_mixed_lt050_dissolve_multiparts_idsep.shp"
####
#START_DIR = "/home/rbraswell/repo/label_centerlines/test"
##test_file = "skidtrails_mixed_lt050_dissolve_multiparts_idsep_subset3.shp"
#test_file = "skidtrails_mixed_lt050_dissolve_multiparts_idsep.shp"
def makelines(input_shp):
output_driver = "GeoJSON"
max_points = 5000 # 3000
simplification = 0.0001 # 0.05
smooth = 0. # 5.
segmentize_maxlen = 0.5 # 0.5
morpho_dist = 1. # 0.
numproc = 1 # 5
minbranchlen = 30 # 30
param = (
max_points,
simplification,
smooth,
segmentize_maxlen,
morpho_dist,
minbranchlen)
paramstr = "_".join([str(p) for p in param])
output_file = os.path.splitext(input_shp)[0] + "_" + paramstr + ".geojson"
print output_file
run(
input_shp,
output_file,
segmentize_maxlen,
max_points,
simplification,
smooth,
morpho_dist,
output_driver,
numproc,
minbranchlen
)
if __name__ == "__main__":
#input_shp = os.path.join(START_DIR, test_file)
input_shp = os.path.join(START_DIR, rodamas_trails)
makelines(input_shp)