-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (61 loc) · 2.41 KB
/
Makefile
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
68
69
70
71
72
73
74
75
76
77
78
79
80
.PHONY: clean all histogram
init_osm_data = .init_osm_data
create_grid = .create_grid
process_testudo_osm = .process_testudo_osm
get_campus = .get_campus
grid_network_voronoi = .grid_network_voronoi
simple_voronoi = .simple_voronoi
vector_network_voronoi = .vector_network_voronoi
empty_rules = $(init_osm_data) $(create_grid) $(process_testudo_osm) $(get_campus) $(grid_network_voronoi) $(simple_voronoi) $(vector_network_voronoi)
overpass = http://overpass-api.de/api/interpreter
data_dir = data
data_basename = $(data_dir)/testudo_data
osm_file = $(data_basename).osm
db_file = $(data_basename).db
json_file = $(data_basename).js
tif_file = $(data_basename).tif
data_files = $(osm_file) $(db_file) $(json_file) $(tif_file)
all: $(json_file) $(tif_file) $(vector_network_voronoi)
$(data_dir):
mkdir -p $(data_dir)
$(osm_file): overpass_query.sh | $(data_dir)
./overpass_query.sh $(overpass) $(osm_file)
$(init_osm_data): $(osm_file) init_osm_db.sh footpath_template
-rm --force $(db_file)
./init_osm_db.sh $(osm_file) $(db_file)
touch $(init_osm_data)
$(get_campus): $(init_osm_data) get_campus.sql
spatialite -bail $(db_file) < get_campus.sql
touch $(get_campus)
$(create_grid): $(get_campus) create_grid.sql
spatialite -bail $(db_file) < create_grid.sql
touch $(create_grid)
$(process_testudo_osm): $(init_osm_data) process_testudo_osm.sql
spatialite -bail $(db_file) < process_testudo_osm.sql
touch $(process_testudo_osm)
$(grid_network_voronoi): $(create_grid) $(process_testudo_osm)
spatialite -bail $(db_file) < grid_network_voronoi.sql
touch $(grid_network_voronoi)
$(simple_voronoi): $(process_testudo_osm) $(get_campus)
spatialite -bail $(db_file) < simple_voronoi.sql
touch $(simple_voronoi)
$(vector_network_voronoi): $(process_testudo_osm) network_voronoi.py
python network_voronoi.py $(db_file)
touch $(vector_network_voronoi)
$(json_file): $(simple_voronoi) make_geojson.sh | $(data_dir)
./make_geojson.sh $(db_file) $(json_file)
$(tif_file): $(grid_network_voronoi) | $(data_dir)
gdal_rasterize -l grid_net_testudo\
-a n\
-tr 0.0005 0.0005\
-a_nodata 0.0\
-te -76.9616585 38.9810767 -76.930857 39.0028657\
-ot Byte\
-of GTiff\
$(db_file)\
$(tif_file)
histogram: $(tif_file) histogram.py
./histogram.py $(tif_file)
clean:
rm --force $(data_files) $(empty_rules)
rmdir $(data_dir)