forked from openmaptiles/openmaptiles
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
227 lines (192 loc) · 11.5 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
all: build/openmaptiles.tm2source/data.yml build/mapping.yaml build/tileset.sql
help:
@echo "=============================================================================="
@echo " OpenMapTiles https://github.com/openmaptiles/openmaptiles "
@echo "Hints for testing areas "
@echo " make download-geofabrik-list # list actual geofabrik OSM extracts for download -> <<your-area>> "
@echo " make list # list actual geofabrik OSM extracts for download -> <<your-area>> "
@echo " ./quickstart.sh <<your-area>> # example: ./quickstart.sh madagascar "
@echo " "
@echo "Hints for designers:"
@echo " make start-postserve # start Postserver + Maputnik Editor [ see localhost:8088 ] "
@echo " make start-tileserver # start klokantech/tileserver-gl [ see localhost:8080 ] "
@echo " "
@echo "Hints for developers:"
@echo " make # build source code"
@echo " make download-geofabrik area=albania # download OSM data from geofabrik, and create config file"
@echo " make psql # start PostgreSQL console"
@echo " make psql-list-tables # list all PostgreSQL tables"
@echo " make psql-vacuum-analyze # PostgreSQL: VACUUM ANALYZE"
@echo " make psql-analyze # PostgreSQL: ANALYZE"
@echo " make generate-qareports # generate reports [./build/qareports]"
@echo " make generate-devdoc # generate devdoc [./build/devdoc]"
@echo " make import-sql-dev # start import-sql /bin/bash terminal"
@echo " make import-osm-dev # start import-osm /bin/bash terminal (imposm3)"
@echo " make clean-docker # remove docker containers, PG data volume"
@echo " make forced-clean-sql # drop all PostgreSQL tables for clean environment"
@echo " make docker-unnecessary-clean # clean unnecessary docker image(s) and container(s)"
@echo " make refresh-docker-images # refresh openmaptiles docker images from Docker HUB"
@echo " make remove-docker-images # remove openmaptiles docker images"
@echo " make pgclimb-list-views # list PostgreSQL public schema views"
@echo " make pgclimb-list-tables # list PostgreSQL public schema tables"
@echo " cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information"
@echo " cat ./quickstart.log # backup of the last ./quickstart.sh"
@echo " make help # help about available commands"
@echo "=============================================================================="
build/openmaptiles.tm2source/data.yml:
mkdir -p build/openmaptiles.tm2source && generate-tm2source openmaptiles.yaml --host="postgres" --port=5432 --database="openmaptiles" --user="openmaptiles" --password="openmaptiles" > build/openmaptiles.tm2source/data.yml
build/mapping.yaml:
mkdir -p build && generate-imposm3 openmaptiles.yaml > build/mapping.yaml
build/tileset.sql:
mkdir -p build && generate-sql openmaptiles.yaml > build/tileset.sql
clean:
rm -f build/openmaptiles.tm2source/data.yml && rm -f build/mapping.yaml && rm -f build/tileset.sql
clean-docker:
docker-compose down -v --remove-orphans
docker-compose rm -fv
docker volume ls -q | grep openmaptiles | xargs -r docker volume rm || true
db-start:
docker-compose up -d postgres
download-geofabrik:
@echo =============== download-geofabrik =======================
@echo Download area : $(area)
@echo [[ example: make download-geofabrik area=albania ]]
@echo [[ list areas: make download-geofabrik-list ]]
docker-compose run --rm import-osm ./download-geofabrik.sh $(area)
ls -la ./data/$(area).*
@echo "Generated config file: ./data/docker-compose-config.yml"
@echo " "
cat ./data/docker-compose-config.yml
@echo " "
psql: db-start
docker-compose run --rm import-osm /usr/src/app/psql.sh
cfg-remake:
docker-compose run --rm openmaptiles-tools make clean
docker-compose run --rm openmaptiles-tools make
import-osm: db-start
docker-compose run --rm openmaptiles-tools make clean
docker-compose run --rm openmaptiles-tools make
docker-compose run --rm import-osm
import-sql: db-start
docker-compose run --rm openmaptiles-tools make clean
docker-compose run --rm openmaptiles-tools make
docker-compose run --rm import-sql
import-osmsql: db-start
docker-compose run --rm openmaptiles-tools make clean
docker-compose run --rm openmaptiles-tools make
docker-compose run --rm import-osm
docker-compose run --rm import-sql
generate-tiles: db-start
rm -rf data/tiles.mbtiles
docker-compose run --rm openmaptiles-tools make clean
docker-compose run --rm openmaptiles-tools make
if [ -f ./data/docker-compose-config.yml ]; then \
docker-compose -f docker-compose.yml -f ./data/docker-compose-config.yml run --rm generate-vectortiles; \
else \
docker-compose run --rm generate-vectortiles; \
fi
docker-compose run --rm openmaptiles-tools generate-metadata ./data/tiles.mbtiles
docker-compose run --rm openmaptiles-tools chmod 666 ./data/tiles.mbtiles
start-tileserver:
@echo " "
@echo "***********************************************************"
@echo "* "
@echo "* Download/refresh klokantech/tileserver-gl docker image"
@echo "* see documentation: https://github.com/klokantech/tileserver-gl"
@echo "* "
@echo "***********************************************************"
@echo " "
docker pull klokantech/tileserver-gl
@echo " "
@echo "***********************************************************"
@echo "* "
@echo "* Start klokantech/tileserver-gl "
@echo "* ----------------------------> check localhost:8080 "
@echo "* "
@echo "***********************************************************"
@echo " "
docker run -it --rm --name tileserver-gl -v $$(pwd)/data:/data -p 8080:80 klokantech/tileserver-gl
start-postserve:
@echo " "
@echo "***********************************************************"
@echo "* "
@echo "* Bring up postserve at localhost:8090/tiles/{z}/{x}/{y}.pbf"
@echo "* "
@echo "***********************************************************"
@echo " "
docker-compose up -d postserve
docker pull maputnik/editor
@echo " "
@echo "***********************************************************"
@echo "* "
@echo "* Start maputnik/editor "
@echo "* ----------------------------> check localhost:8088 "
@echo "* "
@echo "***********************************************************"
@echo " "
docker rm -f maputnik_editor || true
docker run --name maputnik_editor -d -p 8088:8888 maputnik/editor
generate-qareports:
./qa/run.sh
# work in progress - please don't remove
generate-devdoc:
mkdir -p ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/aeroway/aeroway.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/boundary/boundary.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/building/building.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/housenumber/housenumber.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/landcover/landcover.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/landuse/landuse.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/park/park.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/place/place.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/poi/poi.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/transportation/transportation.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/transportation_name/transportation_name.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/water/water.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/water_name/water_name.yaml ./build/devdoc
docker run --rm -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/waterway/waterway.yaml ./build/devdoc
import-sql-dev:
docker-compose run --rm import-sql /bin/bash
import-osm-dev:
docker-compose run --rm import-osm /bin/bash
# the `download-geofabrik` error message mention `list`, if the area parameter is wrong. so I created a similar make command
list:
docker-compose run --rm import-osm ./download-geofabrik-list.sh
# same as a `make list`
download-geofabrik-list:
docker-compose run --rm import-osm ./download-geofabrik-list.sh
download-wikidata:
mkdir -p wikidata && docker-compose run --rm --entrypoint /usr/src/app/download-gz.sh import-wikidata
psql-list-tables:
docker-compose run --rm import-osm /usr/src/app/psql.sh -P pager=off -c "\d+"
psql-pg-stat-reset:
docker-compose run --rm import-osm /usr/src/app/psql.sh -P pager=off -c 'SELECT pg_stat_statements_reset();'
forced-clean-sql:
docker-compose run --rm import-osm /usr/src/app/psql.sh -c "DROP SCHEMA IF EXISTS public CASCADE ; CREATE SCHEMA IF NOT EXISTS public; "
docker-compose run --rm import-osm /usr/src/app/psql.sh -c "CREATE EXTENSION hstore; CREATE EXTENSION postgis; CREATE EXTENSION unaccent; CREATE EXTENSION fuzzystrmatch; CREATE EXTENSION osml10n; CREATE EXTENSION pg_stat_statements;"
docker-compose run --rm import-osm /usr/src/app/psql.sh -c "GRANT ALL ON SCHEMA public TO public;COMMENT ON SCHEMA public IS 'standard public schema';"
pgclimb-list-views:
docker-compose run --rm import-osm /usr/src/app/pgclimb.sh -c "select schemaname,viewname from pg_views where schemaname='public' order by viewname;" csv
pgclimb-list-tables:
docker-compose run --rm import-osm /usr/src/app/pgclimb.sh -c "select schemaname,tablename from pg_tables where schemaname='public' order by tablename;" csv
psql-vacuum-analyze:
@echo "Start - postgresql: VACUUM ANALYZE VERBOSE;"
docker-compose run --rm import-osm /usr/src/app/psql.sh -P pager=off -c 'VACUUM ANALYZE VERBOSE;'
psql-analyze:
@echo "Start - postgresql: ANALYZE VERBOSE ;"
docker-compose run --rm import-osm /usr/src/app/psql.sh -P pager=off -c 'ANALYZE VERBOSE;'
list-docker-images:
docker images | grep openmaptiles
refresh-docker-images:
docker-compose pull --ignore-pull-failures
remove-docker-images:
@echo "Deleting all openmaptiles related docker image(s)..."
@docker-compose down
@docker images | grep "openmaptiles" | awk -F" " '{print $$3}' | xargs --no-run-if-empty docker rmi -f
@docker images | grep "osm2vectortiles/mapbox-studio" | awk -F" " '{print $$3}' | xargs --no-run-if-empty docker rmi -f
@docker images | grep "klokantech/tileserver-gl" | awk -F" " '{print $$3}' | xargs --no-run-if-empty docker rmi -f
docker-unnecessary-clean:
@echo "Deleting unnecessary container(s)..."
@docker ps -a | grep Exited | awk -F" " '{print $$1}' | xargs --no-run-if-empty docker rm
@echo "Deleting unnecessary image(s)..."
@docker images | grep \<none\> | awk -F" " '{print $$3}' | xargs --no-run-if-empty docker rmi