-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_routing.py
67 lines (50 loc) · 1.57 KB
/
test_routing.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
65
66
67
from forestcost import routing as r
def test_routing_mill_shp():
mill_shp = 'Data//mills.shp'
# Landing Coordinates
landing_coords = (-118.620, 44.911)
haulDist, haulTime, coord_mill = r.routing(
landing_coords,
mill_shp=mill_shp
)
print "Using shapefile to find nearest mill..."
print "Distance:", haulDist
print "Time:", haulTime
print "Landing coordinate:", landing_coords
print "Mill coordinate:", coord_mill
print
def test_routing_mill_filter():
mill_shp = 'Data//mills.shp'
mill_filter = "CITY = 'John Day'"
# Landing Coordinates
landing_coords = (-118.620, 44.911)
haulDist, haulTime, coord_mill = r.routing(
landing_coords,
mill_shp=mill_shp,
mill_filter=mill_filter,
)
print "Using shapefile filtered for `%s`..." % mill_filter
print "Distance:", haulDist
print "Time:", haulTime
print "Landing coordinate:", landing_coords
print "Mill coordinate:", coord_mill
print
def test_routing_mill_coords():
mill_coords = (-119.250013, 44.429948)
# Landing Coordinates
landing_coords = (-118.620, 44.911)
haulDist, haulTime, coord_mill = r.routing(
landing_coords,
mill_coords=mill_coords,
)
print "Using specified mill coordinates"
print "Distance:", haulDist
print "Time:", haulTime
print "Landing coordinate:", landing_coords
print "Mill coordinate:", coord_mill
print
if __name__ == "__main__":
print
test_routing_mill_shp()
test_routing_mill_coords()
test_routing_mill_filter()