@geoalgeria/buses 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ {
2
+ "source": "ETUSA (Établissement de transport urbain et suburbain d'Alger) — line list via fr.wikipedia",
3
+ "origin": "https://fr.wikipedia.org/wiki/Lignes_de_bus_ETUSA_de_1_à_99",
4
+ "license": "Line data from Wikipedia (CC BY-SA 4.0) — attribution + share-alike. Operator: ETUSA. See README.",
5
+ "lines": 50,
6
+ "operators": [
7
+ "ETUSA"
8
+ ],
9
+ "by_operator": {
10
+ "ETUSA": 50
11
+ },
12
+ "with_stop_count": 44,
13
+ "wilayas_covered": 1,
14
+ "coverage_note": "v1 covers 50 ETUSA lines (fr.wikipedia 'Lignes de bus ETUSA de 1 à 99'), of ~122 ETUSA passenger lines. Line-level attributes only — per-stop and per-line GEOMETRY (OSM route=bus) is deferred to v1.1; ETUSA-tagged OSM route coverage is currently thin. More operators/cities to be added.",
15
+ "generated_at": "2026-07-01"
16
+ }
package/index.js ADDED
@@ -0,0 +1,18 @@
1
+ // @geoalgeria/buses — loaders for Algeria's urban bus networks (line-level).
2
+ import { readFileSync } from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, join } from "node:path";
5
+
6
+ const DATA = join(dirname(fileURLToPath(import.meta.url)), "data");
7
+ const load = (p) => JSON.parse(readFileSync(join(DATA, p), "utf-8"));
8
+
9
+ export const lines = () => load("lines.json"); // urban bus lines (v1: ETUSA/Alger)
10
+ export const lineById = (id) => lines().find((l) => l.id === id) ?? null;
11
+ export const linesByOperator = (operator) => {
12
+ const op = String(operator).toUpperCase();
13
+ return lines().filter((l) => l.operator.toUpperCase() === op);
14
+ };
15
+ export const operators = () => [...new Set(lines().map((l) => l.operator))];
16
+ export const metadata = () => load("metadata.json");
17
+
18
+ export default { lines, lineById, linesByOperator, operators, metadata };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@geoalgeria/buses",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Algeria's urban bus networks — line-level data (termini, stop counts, communes & transit stations served). First operator: ETUSA (Alger), 50 lines. Multi-operator umbrella. Sourced from fr.wikipedia. JSON, CSV, TypeScript.",
6
+ "main": "index.js",
7
+ "types": "types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./types/index.d.ts",
11
+ "default": "./index.js"
12
+ },
13
+ "./data/*": "./data/*"
14
+ },
15
+ "files": [
16
+ "data/**/*.json",
17
+ "data/**/*.csv",
18
+ "types/",
19
+ "index.js"
20
+ ],
21
+ "scripts": {
22
+ "fetch": "node scripts/fetch.mjs",
23
+ "test": "node ../../scripts/validate-packages.mjs buses"
24
+ },
25
+ "keywords": [
26
+ "algeria",
27
+ "bus",
28
+ "autobus",
29
+ "bus-lines",
30
+ "ligne-bus",
31
+ "etusa",
32
+ "alger",
33
+ "urban-transport",
34
+ "transport",
35
+ "geoalgeria",
36
+ "dz"
37
+ ],
38
+ "author": "Yasser's Studio (https://yasser.studio)",
39
+ "license": "MIT",
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "bugs": {
44
+ "url": "https://github.com/yasserstudio/geoalgeria/issues"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/yasserstudio/geoalgeria.git",
49
+ "directory": "packages/buses"
50
+ },
51
+ "homepage": "https://geoalgeria.com",
52
+ "engines": {
53
+ "node": ">=18"
54
+ }
55
+ }
@@ -0,0 +1,62 @@
1
+ // Type definitions for @geoalgeria/buses
2
+ // Algeria's urban bus networks (line-level). Multi-operator; v1: ETUSA (Alger).
3
+
4
+ /** An urban bus line. */
5
+ export interface BusLine {
6
+ /** Stable id, `{operator}-{line}` (e.g. "etusa-1"). */
7
+ id: string;
8
+ /** Operating company (e.g. "ETUSA"). */
9
+ operator: string;
10
+ /** Network / city (e.g. "Alger"). */
11
+ network: string;
12
+ /** Line number/label as published (e.g. "1", "16B"). */
13
+ line: string;
14
+ /** First terminus, or null. */
15
+ terminus1: string | null;
16
+ /** Second terminus, or null. */
17
+ terminus2: string | null;
18
+ /** Number of stops where published, or null. */
19
+ stops: number | null;
20
+ /** Communes served (French display names). */
21
+ communes_served: string[];
22
+ /** Metro/tram/gare stations served en route (French display names). */
23
+ stations_served: string[];
24
+ /** Wilaya code, zero-padded to 2 digits ("16" for Alger). Joins `geoalgeria`. */
25
+ wilaya_code: string;
26
+ /** Source URL. */
27
+ source: string;
28
+ }
29
+
30
+ /** Dataset metadata (data/metadata.json). */
31
+ export interface Metadata {
32
+ source: string;
33
+ origin: string;
34
+ license: string;
35
+ lines: number;
36
+ operators: string[];
37
+ by_operator: Record<string, number>;
38
+ with_stop_count: number;
39
+ wilayas_covered: number;
40
+ coverage_note: string;
41
+ generated_at: string;
42
+ }
43
+
44
+ /** All bus lines. */
45
+ export function lines(): BusLine[];
46
+ /** One line by id, or null. */
47
+ export function lineById(id: string): BusLine | null;
48
+ /** Lines for an operator (case-insensitive). */
49
+ export function linesByOperator(operator: string): BusLine[];
50
+ /** Distinct operators present. */
51
+ export function operators(): string[];
52
+ /** Dataset metadata. */
53
+ export function metadata(): Metadata;
54
+
55
+ declare const _default: {
56
+ lines: typeof lines;
57
+ lineById: typeof lineById;
58
+ linesByOperator: typeof linesByOperator;
59
+ operators: typeof operators;
60
+ metadata: typeof metadata;
61
+ };
62
+ export default _default;