Last active
August 29, 2015 14:01
-
-
Save rubo77/2477e20d7f146dfc8707 to your computer and use it in GitHub Desktop.
This file interprets the nodes.json file from http://freifunk.in-kiel.de/ffmap/nodes.json and creates a csv from it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
ob_start(); | |
echo "name;geo1;geo2;id;macs;legacy\n"; | |
$n=json_decode(file_get_contents("nodes.json")); | |
foreach($n->nodes as $o) if(!$o->flags->gateway){ | |
if(empty($o->name)) { | |
#var_dump($o); die; | |
$o->name=$o->id; | |
} | |
echo $o->name.";"; | |
echo($o->geo[0]).";"; | |
echo($o->geo[1]).";"; | |
echo $o->id.";"; | |
echo $o->macs.";"; | |
echo !empty($o->flags->legacy).";"; | |
#var_dump($o->flags).";"; | |
echo "\n"; | |
} | |
$out=ob_get_clean(); | |
file_put_contents("nodes.csv",$out); | |
echo $out; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment