[35743] | 1 | puts "tclsh verify-hw.tcl startzoom endzoom --> comparing highway widths, output to verify-hw.txt"
|
---|
| 2 |
|
---|
| 3 | set za [ lindex $argv 0 ]
|
---|
| 4 | set ze [ lindex $argv 1 ]
|
---|
| 5 |
|
---|
| 6 | source verify.tcl
|
---|
| 7 | set fs "%5s"
|
---|
| 8 |
|
---|
| 9 | set allways [ list motorway motorway-link trunk trunk-link primary primary-link \
|
---|
| 10 | secondary secondary-link tertiary tertiary-link unclassified unsurfaced residential livingstreet cycleroad pedestrian service track bridleway cycleway aisle footway path steps ford ]
|
---|
| 11 |
|
---|
| 12 | set ersatz(residential) "unclassified"
|
---|
| 13 | set ersatz(cycleroad) "residential"
|
---|
| 14 | set ersatz(livingstreet) "residential"
|
---|
| 15 | set ersatz(path) "footway"
|
---|
| 16 | set ersatz(ford) "unclassified"
|
---|
| 17 | set ersatzs [ array names ersatz ]
|
---|
| 18 |
|
---|
| 19 | for { set z $za } { $z <= $ze } { incr z } {
|
---|
| 20 | foreach ww $widths($z) {
|
---|
| 21 | set www [ split $ww "-" ]
|
---|
| 22 | if { [ lindex $www 0 ] == "highway" } {
|
---|
| 23 | set w $width($z,$ww)
|
---|
| 24 | if { [ lindex $www 2 ] == "link" } { set j 2 } { set j 1 }
|
---|
| 25 | set k $j; incr k
|
---|
| 26 | set l $k; incr l
|
---|
| 27 | set way [ join [ lrange $www 1 $j ] "-" ]
|
---|
| 28 | if {[lsearch $allways $way] < 0} {puts "$way missing"}
|
---|
| 29 |
|
---|
| 30 | if { [ lsearch $www "bridge" ] > 0 } {
|
---|
| 31 | if { [ lsearch $www "casing" ] > 0 } {
|
---|
| 32 | set bca($z,$way) [ format $fs $w ]
|
---|
| 33 | }
|
---|
| 34 | if { [ lsearch $www "core" ] > 0 } {
|
---|
| 35 | set bco($z,$way) [ format $fs $w ]
|
---|
| 36 | }
|
---|
| 37 | } elseif { [ lsearch $www "cy1" ] > 0 } {
|
---|
| 38 | set cy1($z,$way) [ format $fs $w ]
|
---|
| 39 | } elseif { [ lsearch $www "cy2" ] > 0 } {
|
---|
| 40 | set cy2($z,$way) [ format $fs $w ]
|
---|
| 41 | } elseif { [ lsearch $www "mr1" ] > 0 } {
|
---|
| 42 | set mr1($z,$way) [ format $fs $w ]
|
---|
| 43 | } elseif { [ lsearch $www "mr2" ] > 0 } {
|
---|
| 44 | set mr2($z,$way) [ format $fs $w ]
|
---|
| 45 | } elseif { [ lsearch $www "mrcy1" ] > 0 } {
|
---|
| 46 | set mc1($z,$way) [ format $fs $w ]
|
---|
| 47 | } elseif { [ lsearch $www "mrcy2" ] > 0 } {
|
---|
| 48 | set mc2($z,$way) [ format $fs $w ]
|
---|
| 49 | } elseif { [ lsearch $www "mrcy3" ] > 0 } {
|
---|
| 50 | set mc3($z,$way) [ format $fs $w ]
|
---|
| 51 | } elseif { [ lsearch $www "area" ] > 0 && [ lindex $www $l ] == "casing" } {
|
---|
| 52 | set are($z,$way) [ format $fs $w ]
|
---|
| 53 | } elseif { [ lindex $www $k ] == "casing" } {
|
---|
| 54 | set cas($z,$way) [ format $fs $w ]
|
---|
| 55 | } elseif { [ lindex $www $k ] == "core" } {
|
---|
| 56 | set cor($z,$way) [ format $fs $w ]
|
---|
| 57 | } elseif { [ lindex $www $k ] == "core2" } {
|
---|
| 58 | set co2($z,$way) [ format $fs $w ]
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | for { set z $za } { $z <= $ze } { incr z } {
|
---|
| 65 | foreach way $allways {
|
---|
| 66 | if { [ lsearch $ersatzs $way ] >= 0 } { set e 1 } { set e 0 }
|
---|
| 67 |
|
---|
| 68 | if { ![ info exists bca($z,$way) ] } {
|
---|
| 69 | if { $e } {
|
---|
| 70 | set bca($z,$way) $bca($z,$ersatz($way))
|
---|
| 71 | } else {
|
---|
| 72 | set bca($z,$way) [ format $fs "" ]
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 | if { ![ info exists bco($z,$way) ] } {
|
---|
| 76 | if { $e } {
|
---|
| 77 | set bco($z,$way) $bco($z,$ersatz($way))
|
---|
| 78 | } else {
|
---|
| 79 | set bco($z,$way) [ format $fs "" ]
|
---|
| 80 | }
|
---|
| 81 | }
|
---|
| 82 | if { $z < 16 } {
|
---|
| 83 | set bca($z,$way) [ format $fs "" ]
|
---|
| 84 | set bco($z,$way) [ format $fs "" ]
|
---|
| 85 | }
|
---|
| 86 | if { [ string trim $bca($z,$way) ] != "" } {
|
---|
| 87 | set bdi($z,$way) [ format $fs [ expr "$bca($z,$way) - $bco($z,$way)" ] ]
|
---|
| 88 | } else {
|
---|
| 89 | set bdi($z,$way) [ format $fs "" ]
|
---|
| 90 | }
|
---|
| 91 | if { ![ info exists cas($z,$way) ] } {
|
---|
| 92 | if { $e } {
|
---|
| 93 | set cas($z,$way) $cas($z,$ersatz($way))
|
---|
| 94 | } else {
|
---|
| 95 | set cas($z,$way) [ format $fs "" ]
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 | if { ![ info exists cor($z,$way) ] } {
|
---|
| 99 | if { $e } {
|
---|
| 100 | set cor($z,$way) $cor($z,$ersatz($way))
|
---|
| 101 | } else {
|
---|
| 102 | set cor($z,$way) [ format $fs "" ]
|
---|
| 103 | }
|
---|
| 104 | }
|
---|
| 105 | if { [ string trim $cas($z,$way) ] != "" } {
|
---|
| 106 | set dif($z,$way) [ format $fs [ expr "$cas($z,$way) - $cor($z,$way)" ] ]
|
---|
| 107 | } else {
|
---|
| 108 | set dif($z,$way) [ format $fs "" ]
|
---|
| 109 | }
|
---|
| 110 | if { [ string trim $bca($z,$way) ] != "" } {
|
---|
| 111 | puts $way
|
---|
| 112 | set bd2($z,$way) [ format $fs [ expr "$bco($z,$way) - $cas($z,$way)" ] ]
|
---|
| 113 | } else {
|
---|
| 114 | set bd2($z,$way) [ format $fs "" ]
|
---|
| 115 | }
|
---|
| 116 | if { ![ info exists are($z,$way) ] } {
|
---|
| 117 | if { $e } {
|
---|
| 118 | set are($z,$way) $are($z,$ersatz($way))
|
---|
| 119 | } else {
|
---|
| 120 | set are($z,$way) [ format $fs "" ]
|
---|
| 121 | }
|
---|
| 122 | }
|
---|
| 123 | if { ![ info exists cy1($z,$way) ] } {
|
---|
| 124 | if { $e } {
|
---|
| 125 | set cy1($z,$way) $cy1($z,$ersatz($way))
|
---|
| 126 | } else {
|
---|
| 127 | set cy1($z,$way) [ format $fs "" ]
|
---|
| 128 | }
|
---|
| 129 | }
|
---|
| 130 | if { ![ info exists cy2($z,$way) ] } {
|
---|
| 131 | if { $e } {
|
---|
| 132 | set cy2($z,$way) $cy2($z,$ersatz($way))
|
---|
| 133 | } else {
|
---|
| 134 | set cy2($z,$way) [ format $fs "" ]
|
---|
| 135 | }
|
---|
| 136 | }
|
---|
| 137 | if { [ string trim $cy2($z,$way) ] != "" } {
|
---|
| 138 | set cca($z,$way) [ format $fs [ expr "$cy1($z,$way) - $cy2($z,$way)" ] ]
|
---|
| 139 | set ccy($z,$way) [ format $fs [ expr "$cy2($z,$way) - $cor($z,$way)" ] ]
|
---|
| 140 | } else {
|
---|
| 141 | set cca($z,$way) [ format $fs "" ]
|
---|
| 142 | set ccy($z,$way) [ format $fs "" ]
|
---|
| 143 | }
|
---|
| 144 | if { ![ info exists mr1($z,$way) ] } {
|
---|
| 145 | set mr1($z,$way) [ format $fs "" ]
|
---|
| 146 | }
|
---|
| 147 | if { ![ info exists mr2($z,$way) ] } {
|
---|
| 148 | set mr2($z,$way) [ format $fs "" ]
|
---|
| 149 | }
|
---|
| 150 | if { [ string trim $mr2($z,$way) ] != "" } {
|
---|
| 151 | set mca($z,$way) [ format $fs [ expr "$mr1($z,$way) - $mr2($z,$way)" ] ]
|
---|
| 152 | set mcy($z,$way) [ format $fs [ expr "$mr2($z,$way) - $cor($z,$way)" ] ]
|
---|
| 153 | } else {
|
---|
| 154 | set mca($z,$way) [ format $fs "" ]
|
---|
| 155 | set mcy($z,$way) [ format $fs "" ]
|
---|
| 156 | }
|
---|
| 157 | if { ![ info exists mc1($z,$way) ] } {
|
---|
| 158 | set mc1($z,$way) [ format $fs "" ]
|
---|
| 159 | }
|
---|
| 160 | if { ![ info exists mc2($z,$way) ] } {
|
---|
| 161 | set mc2($z,$way) [ format $fs "" ]
|
---|
| 162 | }
|
---|
| 163 | if { ![ info exists mc3($z,$way) ] } {
|
---|
| 164 | set mc3($z,$way) [ format $fs "" ]
|
---|
| 165 | }
|
---|
| 166 | if { [ string trim $mc2($z,$way) ] != "" } {
|
---|
| 167 | set mma($z,$way) [ format $fs [ expr "$mc1($z,$way) - $mc2($z,$way)" ] ]
|
---|
| 168 | set mmy($z,$way) [ format $fs [ expr "$mc2($z,$way) - $mc3($z,$way)" ] ]
|
---|
| 169 | set mmm($z,$way) [ format $fs [ expr "$mc3($z,$way) - $cor($z,$way)" ] ]
|
---|
| 170 | } else {
|
---|
| 171 | set mma($z,$way) [ format $fs "" ]
|
---|
| 172 | set mmy($z,$way) [ format $fs "" ]
|
---|
| 173 | set mmm($z,$way) [ format $fs "" ]
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | if { ![ info exists co2($z,$way) ] } {
|
---|
| 177 | set co2($z,$way) [ format $fs "" ]
|
---|
| 178 | }
|
---|
| 179 | }
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | set fo [ open verify-hw.txt w ]
|
---|
| 183 |
|
---|
| 184 | puts $fo " : bcas bcor bdif bdi2 cas core diff area cor2 cyc1 cyc2 ccy cca mr1 mr2 mcy mca mc1 mc2 mc3 mmm mmy mma way"
|
---|
| 185 |
|
---|
| 186 | foreach way $allways {
|
---|
| 187 | for { set z $za } { $z <= $ze } { incr z } {
|
---|
| 188 | set x "$z,$way"
|
---|
| 189 | puts $fo "$z:$bca($x)$bco($x)$bdi($x)$bd2($x) $cas($x)$cor($x)$dif($x)$are($x)$co2($x) $cy1($x)$cy2($x)$ccy($x)$cca($x) $mr1($x)$mr2($x)$mcy($x)$mca($x) $mc1($x)$mc2($x)$mc3($x)$mmm($x)$mmy($x)$mma($x) $way"
|
---|
| 190 | }
|
---|
| 191 | puts $fo ""
|
---|
| 192 | }
|
---|
| 193 | close $fo
|
---|