Просмотр исходного кода

Add Makefile to get path data.

Also, `dev-prepare` should be able to use any file you want as an
argument (because I'm lazy).
Lucas Stadler лет назад: 12
Родитель
Сommit
b23166c3fb
3 измененных файлов с 19 добавлено и 9 удалено
  1. 1 0
      clj/.gitignore
  2. 8 0
      clj/Makefile
  3. 10 9
      clj/paths.clj

+ 1 - 0
clj/.gitignore

1
data
1
target
2
target
2
.lein-repl-history
3
.lein-repl-history
3
*.json
4
*.json

+ 8 - 0
clj/Makefile

1
all: paths
2
3
paths:
4
	mkdir -p data
5
	curl --progress-bar http://download.bbbike.org/osm/bbbike/Leipzig/Leipzig.osm.gz \
6
		--output data/leipzig.osm.gz
7
	gzip --decompress --stdout data/leipzig.osm.gz > data/leipzig.osm
8
	osmfilter --keep='highway=*' data/leipzig.osm > data/leipzig_highways.osm

+ 10 - 9
clj/paths.clj

23
23
24
(tags-as-map {:content [{:tag :tag, :attrs {:k :hey, :v 1}}, {:tag :tag, :attrs {:k :there, :v 2}}]})
24
(tags-as-map {:content [{:tag :tag, :attrs {:k :hey, :v 1}}, {:tag :tag, :attrs {:k :there, :v 2}}]})
25
25
26
(defn dev-prepare []
27
  (println "; reading in data/Leipzig_highways.osm...")
28
  (def leipzig
29
    (xml/parse "data/Leipzig_highways.osm"))
30
  (println ";=> availlable in `leipzig`")
31
  (println "; extracting nodes...")
32
  (def leipzig-nodes
33
    (extract-nodes {:content leipzig}))
34
  (println "; => availlable in `leipzig-nodes`"))
26
(defn dev-prepare [& [path]]
27
  (let [path (or path "data/leipzig_highways.osm")]
28
    (println "; reading in" path "...")
29
    (def leipzig
30
      (xml/parse path))
31
    (println ";=> availlable in `leipzig`")
32
    (println "; extracting nodes...")
33
    (def leipzig-nodes
34
      (extract-nodes {:content leipzig}))
35
    (println "; => availlable in `leipzig-nodes`")))