-
Notifications
You must be signed in to change notification settings - Fork 7
/
extract.bat
executable file
·98 lines (76 loc) · 2.77 KB
/
extract.bat
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
@echo off
rem Extract OSM data for conflation using Osmosis
rem Usage: extract PATH
rem PATH should contain a '.pbf' file with the input data and a 'boundary.poly'
rem file whit the boundary polygon limits.
rem Sugested source for pbf's https://mapzen.com/data/metro-extracts/
if "%1"=="" (
echo Uso: %0 PATH
goto END
)
set OUTPATH=%1
if not exist "%1\*.pbf" (
echo PATH debe contener un fichero .pbf
goto END
)
for /f "delims=" %%F in ('dir %OUTPATH%\*.pbf /b') do set PBFFILE="%OUTPATH%\%%F"
set POLYGON="%OUTPATH%\boundary.poly"
if not exist %POLYGON% (
echo PATH debe contener un fichero boundary.poly
goto END
)
set CURADDR="%OUTPATH%\current_address.osm"
if not exist %CURADDR% call osmosis ^
--read-pbf %PBFFILE% ^
--node-key keyList="addr:street,addr:place" ^
--tag-filter accept-nodes "addr:housenumber=*" outPipe.0=nodedata ^
^
--read-pbf %PBFFILE% ^
--way-key keyList="addr:street,addr:place" ^
--tf reject-relations --used-node outPipe.0=waydata ^
--tf reject-relations --used-node outPipe.0=waydata ^
^
--merge inPipe.0=nodedata inPipe.1=waydata outPipe.0=waynodedata ^
^
--read-pbf %PBFFILE% ^
--tag-filter accept-relations "addr:street=*" "addr:plac=*" ^
--tag-filter accept-relations "addr:housenumber=*" ^
--used-way --used-node outPipe.0=reldata ^
^
--merge inPipe.0=waynodedata inPipe.1=reldata ^
--write-xml %CURADDR%
set CURHGW="%OUTPATH%\current_highway.osm"
if not exist %CURHGW% call osmosis ^
--read-pbf %PBFFILE% ^
--node-key-value keyValueList="place.square" outPipe.0=nodedata ^
^
--read-pbf %PBFFILE% ^
--tag-filter accept-ways "highway=*" "place=square" ^
--tag-filter accept-ways "name=*" ^
--tf reject-relations --used-node outPipe.0=waydata ^
^
--merge inPipe.0=nodedata inPipe.1=waydata outPipe.0=waynodedata ^
^
--read-pbf %PBFFILE% ^
--tag-filter accept-relations "place=square" ^
--tag-filter accept-relations "name=*" ^
--used-way --used-node outPipe.0=reldata ^
^
--merge inPipe.0=waynodedata inPipe.1=reldata ^
--bounding-polygon file=%POLYGON% ^
--write-xml %CURHGW%
set CURBU="%OUTPATH%\current_building.osm"
if not exist %CURBU% call osmosis ^
--read-pbf %PBFFILE% ^
--tag-filter accept-ways "building=*" "leisure=swimming_pool" ^
--tf reject-relations --used-node outPipe.0=waydata ^
^
--read-pbf %PBFFILE% ^
--tag-filter accept-relations "building=*" "leisure=swimming_pool" ^
--used-way --used-node outPipe.0=reldata ^
^
--merge inPipe.0=waydata inPipe.1=reldata ^
--bounding-polygon file=%POLYGON% ^
--write-xml %CURBU%
dir "%OUTPATH%\current_*.osm"
:END