ext/plain; charset=UTF-8
Content-Disposition: inline; filename="fea6e37e0a98743466c0f12ae111358cbb4dbdc1..fe042a02f1035eb58c6b29f10b00ca6e7e0d006e.patch"
Last-Modified: Wed, 06 Nov 2024 15:57:24 GMT
Expires: Sat, 04 Nov 2034 15:57:24 GMT

ver for linuxforks</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/static/cgit.css'/>
<link rel='shortcut icon' href='//bananach.space/favicon.png'/>
<link rel='alternate' title='Atom feed' href='http://git.bananach.space/lifomapserver.git/atom/scripts/geojson/fetch_streets.sh?h=master' type='application/atom+xml'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='//bananach.space/bananach.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/lifomapserver.git/'>lifomapserver.git</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'/><select name='h' onchange='this.form.submit();'>
<option value='dev'>dev</option>
<option value='feature/configurable_geojson'>feature/configurable_geojson</option>
<option value='master' selected='selected'>master</option>
<option value='signals'>signals</option>
<option value='ywang-patch'>ywang-patch</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>map server for linuxforks</td><td class='sub right'>m42uko</td></tr></table>
<table class='tabs'><tr><td>
<a href='/lifomapserver.git/'>summary</a><a href='/lifomapserver.git/refs/?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>refs</a><a href='/lifomapserver.git/log/scripts/geojson/fetch_streets.sh'>log</a><a class='active' href='/lifomapserver.git/tree/scripts/geojson/fetch_streets.sh?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>tree</a><a href='/lifomapserver.git/commit/scripts/geojson/fetch_streets.sh?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>commit</a><a href='/lifomapserver.git/diff/scripts/geojson/fetch_streets.sh?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>diff</a></td><td class='form'><form class='right' method='get' action='/lifomapserver.git/log/scripts/geojson/fetch_streets.sh'>
<input type='hidden' name='id' value='9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/lifomapserver.git/tree/?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>root</a>/<a href='/lifomapserver.git/tree/scripts?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>scripts</a>/<a href='/lifomapserver.git/tree/scripts/geojson?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>geojson</a>/<a href='/lifomapserver.git/tree/scripts/geojson/fetch_streets.sh?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>fetch_streets.sh</a></div><div class='content'>blob: dbae43df90272afaee854834bea920cc64dc9e4d (<a href='/lifomapserver.git/plain/scripts/geojson/fetch_streets.sh?id=9bac7e4678ef1d05e1d9fb4b24e79b05b70bae84'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
<a id='n8' href='#n8'>8</a>
<a id='n9' href='#n9'>9</a>
<a id='n10' href='#n10'>10</a>
<a id='n11' href='#n11'>11</a>
<a id='n12' href='#n12'>12</a>
<a id='n13' href='#n13'>13</a>
<a id='n14' href='#n14'>14</a>
<a id='n15' href='#n15'>15</a>
<a id='n16' href='#n16'>16</a>
<a id='n17' href='#n17'>17</a>
<a id='n18' href='#n18'>18</a>
<a id='n19' href='#n19'>19</a>
<a id='n20' href='#n20'>20</a>
<a id='n21' href='#n21'>21</a>
<a id='n22' href='#n22'>22</a>
<a id='n23' href='#n23'>23</a>
<a id='n24' href='#n24'>24</a>
<a id='n25' href='#n25'>25</a>
<a id='n26' href='#n26'>26</a>
<a id='n27' href='#n27'>27</a>
<a id='n28' href='#n28'>28</a>
<a id='n29' href='#n29'>29</a>
</pre></td>
<td class='lines'><pre><code><span class="hl slc">#!/bin/bash</span>

<span class="hl slc"># WARNING: This script is not yet production ready. The slightest error in the wikipage can throw it off. Handle with care.</span>

json<span class="hl opt">=</span><span class="hl str">`curl &apos;https://wiki.linux-forks.de/mediawiki/api.php?action=query&amp;prop=revisions&amp;rvprop=content&amp;format=json&amp;titles=Maps:Streets&apos;`</span>
data<span class="hl opt">=</span><span class="hl str">`echo</span> <span class="hl ipl">$json</span> <span class="hl str">| json_reformat | sed -e &apos;s/</span><span class="hl esc">\\\\</span><span class="hl str">n//g&apos; -n -e &apos;s/begin:mapdata\([^}]\+\)/\1/gp&apos; | sed -e &quot;s/|-|/}/g&quot;`</span>

<span class="hl kwb">echo</span> <span class="hl str">&quot;[&quot;</span>
<span class="hl kwb">export</span> IFS<span class="hl opt">=</span><span class="hl str">&quot;}&quot;</span>
<span class="hl kwa">for</span> entry <span class="hl kwa">in</span> <span class="hl kwd">$data</span><span class="hl opt">;</span> <span class="hl kwa">do</span>
	name<span class="hl opt">=</span><span class="hl str">`echo</span> <span class="hl ipl">$entry</span> <span class="hl str">| sed -n &apos;s/\s*\([^|]\+\).*/\1/p&apos; | sed &apos;s/ $//&apos;`</span>
	coord<span class="hl opt">=</span><span class="hl str">`echo</span> <span class="hl ipl">$entry</span> <span class="hl str">| sed -n &apos;s/.*||\s*\([^|]\+\).*/\1/p&apos;`</span>
	<span class="hl kwa">if</span> <span class="hl opt">[[</span> <span class="hl str">&quot;</span><span class="hl ipl">$name</span><span class="hl str">&quot;</span> <span class="hl opt">!=</span> <span class="hl str">&quot;&quot;</span> <span class="hl opt">&amp;&amp;</span> <span class="hl str">&quot;</span><span class="hl ipl">$coord</span><span class="hl str">&quot;</span> <span class="hl opt">!=</span> <span class="hl str">&quot;&quot;</span> <span class="hl opt">]];</span> <span class="hl kwa">then</span>
		<span class="hl kwb">echo</span> <span class="hl str">&quot;{</span> <span class="hl esc">\&quot;</span><span class="hl str">type</span><span class="hl esc">\&quot;</span><span class="hl str">:</span> <span class="hl esc">\&quot;</span><span class="hl str">Feature</span><span class="hl esc">\&quot;</span><span class="hl str">,</span>
<span class="hl str"></span>	<span class="hl esc">\&quot;</span><span class="hl str">geometry</span><span class="hl esc">\&quot;</span><span class="hl str">: {</span>
<span class="hl str"></span>		<span class="hl esc">\&quot;</span><span class="hl str">type</span><span class="hl esc">\&quot;</span><span class="hl str">:</span> <span class="hl esc">\&quot;</span><span class="hl str">LineString</span><span class="hl esc">\&quot;</span><span class="hl str">,</span>
<span class="hl str"></span>		<span class="hl esc">\&quot;</span><span class="hl str">coordinates</span><span class="hl esc">\&quot;</span><span class="hl str">: [</span>
<span class="hl str"></span>			<span class="hl ipl">$coord</span>
<span class="hl str">		]</span>
<span class="hl str">	},</span>
<span class="hl str"></span>	<span class="hl esc">\&quot;</span><span class="hl str">properties</span><span class="hl esc">\&quot;</span><span class="hl str">: {</span>
<span class="hl str"></span>		<span class="hl esc">\&quot;</span><span class="hl str">name</span><span class="hl esc">\&quot;</span><span class="hl str">:</span> <span class="hl esc">\&quot;</span><span class="hl str"></span><span class="hl ipl">$name</span><span class="hl str"></span><span class="hl esc">\&quot;</span>
<span class="hl str">	}</span>
<span class="hl str">},&quot;</span>
	<span class="hl kwa">fi</span>
<span class="hl kwa">done</span>
<span class="hl kwb">export</span> IFS<span class="hl opt">=</span><span class="hl str">&quot; &quot;</span>
<span class="hl kwb">echo</span> <span class="hl str">&quot;{}&quot;</span>
<span class="hl kwb">echo</span> <span class="hl str">&quot;]&quot;</span>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.39.1</a>) at 2024-11-06 15:57:24 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
