Skip to content

Instantly share code, notes, and snippets.

@rubo77
Last active August 29, 2015 14:01
Show Gist options
  • Save rubo77/2477e20d7f146dfc8707 to your computer and use it in GitHub Desktop.
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
<?
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