Skip to content

Commit

Permalink
new json list of traces
Browse files Browse the repository at this point in the history
  • Loading branch information
aloxe committed Jul 13, 2024
1 parent 13a426a commit 9f1b85d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions public/datavelo/velotraces.json.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
$velotracks = "json";

// An array of the json file names
$tracks = array();

//Open images directory
$dir = opendir($velotracks);

//List files in tracks directory
while (($file = readdir($dir)) !== false) {
$geojson = json_decode(file_get_contents(__DIR__."/".$velotracks."/".$file));

if (isset($geojson->slug)) {
$date = $geojson->date;
$title = $geojson->title;
$slug = $geojson->slug;
$countries = $geojson->countries;
array_push($tracks,[
'date' => $geojson->date,
'title' => $geojson->title,
'slug' => $geojson->slug,
'countries' => $geojson->countries,
]);
}
}
closedir($dir);
// asort($tracks);
echo json_encode($tracks);
?>

0 comments on commit 9f1b85d

Please sign in to comment.