@geoalgeria/buses 1.0.0 → 2.1.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,75 @@
1
+ {
2
+ "@context": "https://schema.org",
3
+ "@type": "Dataset",
4
+ "name": "Algeria urban and suburban bus lines",
5
+ "alternateName": "Lignes de bus urbaines et suburbaines d'Algérie",
6
+ "identifier": "@geoalgeria/buses",
7
+ "description": "Reviewed urban/suburban release: 76 ETUSA Lines (50 from the retained registry plus 26 whose identity comes from the evidenced OSM operator match alone, chiefly the 6xx/7xx suburban network the registry never listed, including the three suburban runs into Boumerdes and Tipaza), 8 official ETUS Sidi Bel Abbès Lines, 7 current ETUS Tiaret Lines, 5 official ETUS Béjaïa Lines, 5 official ETUSTO Lines, 5 official ETUS Setif Lines, 5 official ETUS Oum El Bouaghi Lines, 4 official ETUL Laghouat Lines, 4 official ETUS M'Sila Lines, 16 official ETUS Aïn Defla Lines across Aïn Defla, Khemis Miliana and El Attaf, 6 official ETUS Annaba Lines (the numbered routes of its 2026 service program; 19 unnumbered services kept as evidence), 10 official ETUS Tlemcen Lines from its 2026 service program, 1 ETO Oran Line (the numbered route among six ETO published as drawings; five destination-named services kept as evidence), and 1 ETUS Mostaganem Line. Laghouat Line refs and Arabic route names come from two dated Operator programs; duty allocations, vehicles, times and an ambiguous ADL route code remain evidence-only. Oum El Bouaghi identities and Arabic endpoints come from five numbered Operator diagrams; major Stations and distances remain Source evidence, while the unnumbered night loop is evidence-only. Aïn Defla identities come from the Operator's 2025 route artwork and Eid service program; AD-2 has reusable OSM geometry reconciled to that identity, the rest are directory-only. Setif Line identities and Arabic endpoints come from official 2026 Operator artwork; Lines 101, 104 and 106B have reusable OSM geometry reconciled to the announced identities. Lines 105 and 106A remain directory-only because no current public geometry was found. Béjaïa Line identity, endpoints, typed stop counts and service hours come from the Operator API and linked timetable panels; Sidi Bel Abbès identities, endpoints and complete directional departures come from supplied official network/timetable HTML; M'Sila identities, endpoints, ordered Arabic stop names and stop counts come from official route diagrams. Operator-controlled map geometry remains validation-only. OSM supplies reusable geometry where available. Shapes are available for 61 ETUSA, 1 ETUS Aïn Defla, 7 Tiaret, 3 Tizi Ouzou, 3 Setif and 1 Mostaganem Lines. An OSM-identified Line carries source \"osm\", no published termini, and links every relation its shape was assembled from so a wrong route can be reported or corrected at the origin. Excludes stale Tiaret ref 33 plus unresolved, taxi, non-ETUSA cross/inter-wilaya, unmatched Setif, ETUAD and validation-only geometry.",
8
+ "conditionsOfAccess": "CC-BY-SA-4.0 AND ODbL-1.0 AND LicenseRef-Operator-Data",
9
+ "isAccessibleForFree": true,
10
+ "creator": {
11
+ "@type": "Organization",
12
+ "name": "Yasser's Studio",
13
+ "url": "https://yasser.studio"
14
+ },
15
+ "spatialCoverage": {
16
+ "@type": "Place",
17
+ "name": "Algeria",
18
+ "geo": {
19
+ "@type": "GeoShape",
20
+ "box": "35.290352 0.078075 36.817264 5.495723"
21
+ }
22
+ },
23
+ "variableMeasured": "1756 records, 16 wilayas",
24
+ "distribution": [
25
+ {
26
+ "@type": "DataDownload",
27
+ "name": "lines (JSON)",
28
+ "encodingFormat": "application/json",
29
+ "contentUrl": "https://cdn.jsdelivr.net/npm/@geoalgeria/buses/data/lines.json"
30
+ },
31
+ {
32
+ "@type": "DataDownload",
33
+ "name": "lines (CSV)",
34
+ "encodingFormat": "text/csv",
35
+ "contentUrl": "https://cdn.jsdelivr.net/npm/@geoalgeria/buses/data/csv/lines.csv"
36
+ },
37
+ {
38
+ "@type": "DataDownload",
39
+ "name": "stations (JSON)",
40
+ "encodingFormat": "application/json",
41
+ "contentUrl": "https://cdn.jsdelivr.net/npm/@geoalgeria/buses/data/stations.json"
42
+ },
43
+ {
44
+ "@type": "DataDownload",
45
+ "name": "stations (CSV)",
46
+ "encodingFormat": "text/csv",
47
+ "contentUrl": "https://cdn.jsdelivr.net/npm/@geoalgeria/buses/data/csv/stations.csv"
48
+ },
49
+ {
50
+ "@type": "DataDownload",
51
+ "name": "stations (GeoJSON)",
52
+ "encodingFormat": "application/geo+json",
53
+ "contentUrl": "https://cdn.jsdelivr.net/npm/@geoalgeria/buses/data/geojson/stations.geojson"
54
+ }
55
+ ],
56
+ "dateModified": "2026-09-04",
57
+ "url": "https://geoalgeria.com",
58
+ "sameAs": "https://github.com/yasserstudio/geoalgeria",
59
+ "citation": [
60
+ "French Wikipedia — Lignes de bus ETUSA de 1 à 99 — CC BY-SA 4.0",
61
+ "ETUS Tiaret — current Lines — Proprietary factual reference data; no open reuse license",
62
+ "ETUSTO — passenger Lines — Proprietary factual reference data; no open reuse license",
63
+ "ETUS Béjaïa — WordPress REST itineraries and Line maps — Proprietary factual reference data; no open reuse license",
64
+ "ETUS M'Sila — official Line pages and diagrams — Proprietary factual reference data; no open reuse license",
65
+ "ETUS Sidi Bel Abbès — network and timetable pages — Proprietary factual reference data; no open reuse license",
66
+ "ETUS Setif — 2026 Line artwork supplied by project owner — Proprietary factual reference data; no open reuse license",
67
+ "ETUS Aïn Defla — 2025 Line artwork and Eid service program supplied by project owner — Proprietary factual reference data; no open reuse license",
68
+ "ETUS Annaba — Eid al-Adha 2026 service program supplied by project owner — Proprietary factual reference data; no open reuse license",
69
+ "ETUS Tlemcen — Eid al-Adha 2026 service program supplied by project owner — Proprietary factual reference data; no open reuse license",
70
+ "ETO Oran — route drawings published on the Operator page, supplied by project owner — Proprietary factual reference data; no open reuse license",
71
+ "ETUS Oum El Bouaghi — numbered Line diagrams supplied by project owner — Proprietary factual reference data; no open reuse license",
72
+ "ETUL Laghouat — dated operating programs supplied by project owner — Proprietary factual reference data; no open reuse license",
73
+ "OpenStreetMap — reviewed urban bus relations — ODbL 1.0 (© OpenStreetMap contributors)"
74
+ ]
75
+ }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // @geoalgeria/buses — loaders for Algeria's urban bus networks (line-level).
1
+ // @geoalgeria/buses — loaders for Algeria's reviewed urban/suburban bus networks.
2
2
  import { readFileSync } from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { dirname, join } from "node:path";
@@ -8,11 +8,33 @@ const load = (p) => JSON.parse(readFileSync(join(DATA, p), "utf-8"));
8
8
 
9
9
  export const lines = () => load("lines.json"); // urban bus lines (v1: ETUSA/Alger)
10
10
  export const lineById = (id) => lines().find((l) => l.id === id) ?? null;
11
+ export const linesByWilaya = (code) => lines().filter((line) => line.wilaya_code === String(code).padStart(2, "0"));
11
12
  export const linesByOperator = (operator) => {
12
13
  const op = String(operator).toUpperCase();
13
14
  return lines().filter((l) => l.operator.toUpperCase() === op);
14
15
  };
15
16
  export const operators = () => [...new Set(lines().map((l) => l.operator))];
17
+ export const operatorRecords = () => load("operators.json");
18
+ export const operatorById = (id) => operatorRecords().find((operator) => operator.id === id) ?? null;
19
+ export const shapes = () => load("shapes.json");
20
+ export const shapeById = (id) => shapes().find((shape) => shape.id === id) ?? null;
21
+ export const shapeForLine = (id) => shapes().find((shape) => shape.line_id === id) ?? null;
22
+ export const directions = () => load("directions.json");
23
+ export const directionsByLine = (id) => directions().filter((direction) => direction.line_id === id);
24
+ export const stations = () => load("stations.json");
25
+ export const stationById = (id) => stations().find((station) => station.id === id) ?? null;
26
+ export const stationsByLine = (id) => stations().filter((station) => station.line_ids.includes(id));
27
+ export const stationsByWilaya = (code) => stations().filter((station) => station.wilaya_code === String(code).padStart(2, "0"));
28
+ export const stationMemberships = () => load("station-memberships.json");
29
+ export const membershipsByDirection = (id) => stationMemberships().filter((membership) => membership.direction_id === id);
16
30
  export const metadata = () => load("metadata.json");
17
31
 
18
- export default { lines, lineById, linesByOperator, operators, metadata };
32
+ export default {
33
+ lines, lineById, linesByWilaya, linesByOperator,
34
+ operators, operatorRecords, operatorById,
35
+ shapes, shapeById, shapeForLine,
36
+ directions, directionsByLine,
37
+ stations, stationById, stationsByLine, stationsByWilaya,
38
+ stationMemberships, membershipsByDirection,
39
+ metadata,
40
+ };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@geoalgeria/buses",
3
- "version": "1.0.0",
3
+ "version": "2.1.0",
4
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.",
5
+ "description": "Reviewed urban and suburban bus data for Algeria: 153 Lines, 76 shapes, 128 Directions and 1,603 Stations across 14 Operators.",
6
6
  "main": "index.js",
7
7
  "types": "types/index.d.ts",
8
8
  "exports": {
@@ -13,8 +13,11 @@
13
13
  "./data/*": "./data/*"
14
14
  },
15
15
  "files": [
16
+ "dataset-metadata.json",
17
+ "NOTICE",
16
18
  "data/**/*.json",
17
19
  "data/**/*.csv",
20
+ "data/**/*.geojson",
18
21
  "types/",
19
22
  "index.js"
20
23
  ],
package/types/index.d.ts CHANGED
@@ -1,62 +1,229 @@
1
- // Type definitions for @geoalgeria/buses
2
- // Algeria's urban bus networks (line-level). Multi-operator; v1: ETUSA (Alger).
1
+ export type GeoPrecision = "exact" | "approximate" | null;
2
+ export type SourceKey = "wikipedia" | "osm" | "wikipedia+osm" | "etus-tiaret" | "etusto" | "etus-bejaia" | "etus-msila" | "etus-sidi-bel-abbes" | "etus-setif" | "etus-setif+osm" | "etus-ain-defla" | "etus-ain-defla+osm" | "etus-annaba" | "etus-tlemcen" | "eto-oran" | "etus-oeb" | "etul-laghouat";
3
+ export type SequenceStatus = "osm_member_order_unvalidated";
4
+ export type ServicePeriod = "regular" | "friday" | "saturday";
5
+ export type ServiceDay = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
6
+
7
+ export interface BusServiceHours {
8
+ period: ServicePeriod;
9
+ days: ServiceDay[];
10
+ direction_from?: string;
11
+ direction_to?: string;
12
+ first_departure: string | null;
13
+ last_departure: string | null;
14
+ operates: boolean;
15
+ }
16
+
17
+ export interface BusDeparture {
18
+ time: string;
19
+ note: string | null;
20
+ }
21
+
22
+ export interface BusDepartureSchedule {
23
+ direction_from: string;
24
+ direction_to: string;
25
+ /** Null when the official page does not state which service days apply. */
26
+ days: ServiceDay[] | null;
27
+ days_note: string | null;
28
+ departures: BusDeparture[];
29
+ }
3
30
 
4
- /** An urban bus line. */
5
31
  export interface BusLine {
6
- /** Stable id, `{operator}-{line}` (e.g. "etusa-1"). */
7
32
  id: string;
8
- /** Operating company (e.g. "ETUSA"). */
33
+ name: string | null;
34
+ name_fr?: string;
35
+ name_ar?: string;
36
+ wilaya_code: string;
37
+ commune_code: null;
38
+ commune: null;
39
+ lat: null;
40
+ lng: null;
41
+ geo_precision: null;
42
+ geo_method: null;
43
+ source: SourceKey;
44
+ operator_id: string;
9
45
  operator: string;
10
- /** Network / city (e.g. "Alger"). */
11
46
  network: string;
12
- /** Line number/label as published (e.g. "1", "16B"). */
13
47
  line: string;
14
- /** First terminus, or null. */
15
48
  terminus1: string | null;
16
- /** Second terminus, or null. */
49
+ terminus1_fr?: string;
50
+ terminus1_ar?: string;
17
51
  terminus2: string | null;
18
- /** Number of stops where published, or null. */
52
+ terminus2_fr?: string;
53
+ terminus2_ar?: string;
19
54
  stops: number | null;
20
- /** Communes served (French display names). */
55
+ major_stops: number | null;
56
+ service_hours: BusServiceHours[];
57
+ departure_schedules?: BusDepartureSchedule[];
58
+ route_diagram_url?: string | null;
21
59
  communes_served: string[];
22
- /** Metro/tram/gare stations served en route (French display names). */
23
60
  stations_served: string[];
24
- /** Wilaya code, zero-padded to 2 digits ("16" for Alger). Joins `geoalgeria`. */
61
+ shape_id: string | null;
62
+ osm_relation_ids: number[];
63
+ source_refs: SourceKey[];
64
+ source_url?: string | null;
65
+ }
66
+
67
+ export interface BusStation {
68
+ id: string;
69
+ name: string | null;
70
+ name_fr: string | null;
71
+ name_ar: string | null;
72
+ wilaya_code: string;
73
+ commune_code: null;
74
+ commune: null;
75
+ lat: number;
76
+ lng: number;
77
+ geo_precision: Exclude<GeoPrecision, null>;
78
+ /** `osm_way_center` is a derived centre, never a mapped node position. */
79
+ geo_method: "osm_node" | "osm_way_center";
80
+ source: "osm";
81
+ osm_type: "node" | "way";
82
+ osm_id: number;
83
+ refs: { osm: string };
84
+ operator_ids: string[];
85
+ line_ids: string[];
86
+ wilaya_method: "point_in_wilaya" | "operator_scope";
87
+ roles: string[];
88
+ highway: string | null;
89
+ public_transport: string | null;
90
+ }
91
+
92
+ export interface BusOperator {
93
+ id: string;
94
+ name: string;
95
+ name_fr: string;
96
+ name_ar: string | null;
97
+ wilaya_codes: string[];
98
+ scope: "urban_suburban";
99
+ line_count: number;
100
+ shape_count: number;
101
+ source_refs: SourceKey[];
102
+ /** The Operator's own site, when one is published and was reachable at capture. */
103
+ website_url: string | null;
104
+ /** The Operator's official Facebook page, verified by title; null when not verified. */
105
+ facebook_url: string | null;
106
+ }
107
+
108
+ export interface MultiLineStringGeometry { type: "MultiLineString"; coordinates: number[][][]; }
109
+
110
+ export interface BusShape {
111
+ id: string;
112
+ line_id: string;
113
+ operator_id: string;
114
+ operator: string;
115
+ network: string;
116
+ line: string;
117
+ name: string | null;
25
118
  wilaya_code: string;
26
- /** Source URL. */
27
- source: string;
119
+ terminus1: string | null;
120
+ terminus1_fr?: string;
121
+ terminus1_ar?: string;
122
+ terminus2: string | null;
123
+ terminus2_fr?: string;
124
+ terminus2_ar?: string;
125
+ source: "osm";
126
+ osm_relation_ids: number[];
127
+ geometry: MultiLineStringGeometry;
128
+ }
129
+
130
+ export interface BusDirection {
131
+ id: string;
132
+ line_id: string;
133
+ shape_id: string;
134
+ osm_relation_id: number;
135
+ from: string | null;
136
+ to: string | null;
137
+ via: string | null;
138
+ public_transport_version: 2 | null;
139
+ sequence_status: SequenceStatus;
140
+ source: "osm" | "etus-setif+osm" | "etus-ain-defla+osm";
141
+ source_refs: SourceKey[];
142
+ }
143
+
144
+ export interface StationMembership {
145
+ id: string;
146
+ direction_id: string;
147
+ line_id: string;
148
+ station_id: string;
149
+ osm_relation_id: number;
150
+ /** Zero-based position in the raw OSM relation member array. */
151
+ osm_member_index: number;
152
+ /** One-based position among Station members in that Direction. */
153
+ source_sequence: number;
154
+ role: string | null;
155
+ sequence_status: SequenceStatus;
156
+ source: "osm";
157
+ }
158
+
159
+ export interface SourceRef {
160
+ key: string;
161
+ name: string;
162
+ url?: string;
163
+ license: string;
164
+ retrieved: string;
165
+ evidence_type: "official" | "crowdsourced" | "derived";
28
166
  }
29
167
 
30
- /** Dataset metadata (data/metadata.json). */
31
168
  export interface Metadata {
32
- source: string;
33
- origin: string;
169
+ package: "@geoalgeria/buses";
170
+ schema_version: "2.0.0";
171
+ title_fr: string;
172
+ title_ar: string;
173
+ title_en: string;
174
+ record_count: number;
175
+ entities: { file: string; count: number }[];
176
+ geocoded_count: number;
177
+ geocoded_pct: number;
178
+ precision: { exact: number; approximate: number };
179
+ estimated_universe: null;
180
+ coverage_pct: null;
181
+ coverage_note: string;
182
+ wilayas_covered: number;
183
+ bbox: [number, number, number, number];
184
+ sources: SourceRef[];
34
185
  license: string;
35
- lines: number;
186
+ updated: string;
36
187
  operators: string[];
37
188
  by_operator: Record<string, number>;
38
189
  with_stop_count: number;
39
- wilayas_covered: number;
40
- coverage_note: string;
41
- generated_at: string;
190
+ with_major_stop_count: number;
191
+ with_service_hours: number;
192
+ with_departure_schedules: number;
193
+ shapes: number;
194
+ directions: number;
195
+ stations: number;
196
+ station_memberships: number;
42
197
  }
43
198
 
44
- /** All bus lines. */
45
199
  export function lines(): BusLine[];
46
- /** One line by id, or null. */
47
200
  export function lineById(id: string): BusLine | null;
48
- /** Lines for an operator (case-insensitive). */
201
+ export function linesByWilaya(code: string | number): BusLine[];
49
202
  export function linesByOperator(operator: string): BusLine[];
50
- /** Distinct operators present. */
203
+ /** Backward-compatible list of Operator display labels. */
51
204
  export function operators(): string[];
52
- /** Dataset metadata. */
205
+ export function operatorRecords(): BusOperator[];
206
+ export function operatorById(id: string): BusOperator | null;
207
+ export function shapes(): BusShape[];
208
+ export function shapeById(id: string): BusShape | null;
209
+ export function shapeForLine(lineId: string): BusShape | null;
210
+ export function directions(): BusDirection[];
211
+ export function directionsByLine(lineId: string): BusDirection[];
212
+ export function stations(): BusStation[];
213
+ export function stationById(id: string): BusStation | null;
214
+ export function stationsByLine(lineId: string): BusStation[];
215
+ export function stationsByWilaya(code: string | number): BusStation[];
216
+ export function stationMemberships(): StationMembership[];
217
+ export function membershipsByDirection(directionId: string): StationMembership[];
53
218
  export function metadata(): Metadata;
54
219
 
55
220
  declare const _default: {
56
- lines: typeof lines;
57
- lineById: typeof lineById;
58
- linesByOperator: typeof linesByOperator;
59
- operators: typeof operators;
221
+ lines: typeof lines; lineById: typeof lineById; linesByWilaya: typeof linesByWilaya; linesByOperator: typeof linesByOperator;
222
+ operators: typeof operators; operatorRecords: typeof operatorRecords; operatorById: typeof operatorById;
223
+ shapes: typeof shapes; shapeById: typeof shapeById; shapeForLine: typeof shapeForLine;
224
+ directions: typeof directions; directionsByLine: typeof directionsByLine;
225
+ stations: typeof stations; stationById: typeof stationById; stationsByLine: typeof stationsByLine; stationsByWilaya: typeof stationsByWilaya;
226
+ stationMemberships: typeof stationMemberships; membershipsByDirection: typeof membershipsByDirection;
60
227
  metadata: typeof metadata;
61
228
  };
62
229
  export default _default;