2021-05-11 19:39:24 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2022-07-05 22:20:12 +00:00
|
|
|
import * as network from '../src/data/network.js';
|
2021-05-11 19:39:24 +00:00
|
|
|
import fs from 'fs/promises';
|
|
|
|
|
2022-07-05 02:40:29 +00:00
|
|
|
/** Geographical bounds of the Montpellier metropolitan area. */
|
|
|
|
const bounds = [
|
|
|
|
"43.49552248630757", "3.660507202148437",
|
|
|
|
"43.73736766145917", "4.092750549316406",
|
|
|
|
];
|
|
|
|
|
|
|
|
const data = await network.fetch("TaM", "tram", bounds);
|
2021-05-11 19:39:24 +00:00
|
|
|
|
|
|
|
await fs.writeFile(
|
2022-07-05 22:20:12 +00:00
|
|
|
new URL("../src/data/network.json", import.meta.url),
|
2021-05-11 19:39:24 +00:00
|
|
|
JSON.stringify(
|
|
|
|
data,
|
|
|
|
(_, value) =>
|
|
|
|
{
|
|
|
|
if (value instanceof Set)
|
|
|
|
{
|
|
|
|
// Convert sets to arrays for JSON representation
|
|
|
|
return Array.from(value.values());
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
},
|
|
|
|
4
|
|
|
|
)
|
|
|
|
);
|