@geoalgeria/buses 2.0.0 → 2.1.1

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.
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "@context": "https://schema.org",
3
3
  "@type": "Dataset",
4
- "name": "ETUSA urban bus lines (Algiers)",
5
- "alternateName": "Lignes de bus ETUSA (Alger)",
4
+ "name": "Algeria urban and suburban bus lines",
5
+ "alternateName": "Lignes de bus urbaines et suburbaines d'Algérie",
6
6
  "identifier": "@geoalgeria/buses",
7
- "description": "50 of ETUSA's ~122 passenger lines (fr.wikipedia 'Lignes de bus ETUSA de 1 à 99'). Line-level attributes only; per-stop and per-line geometry deferred (OSM route=bus coverage tagged ETUSA is currently thin). No coordinates exist for this dataset — lat/lng are null and geo_precision reflects that honestly.",
8
- "license": "https://creativecommons.org/licenses/by-sa/4.0/",
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
9
  "isAccessibleForFree": true,
10
10
  "creator": {
11
11
  "@type": "Organization",
@@ -14,9 +14,13 @@
14
14
  },
15
15
  "spatialCoverage": {
16
16
  "@type": "Place",
17
- "name": "Algeria"
17
+ "name": "Algeria",
18
+ "geo": {
19
+ "@type": "GeoShape",
20
+ "box": "35.290352 0.078075 36.817264 5.495723"
21
+ }
18
22
  },
19
- "variableMeasured": "50 records, 1 wilayas",
23
+ "variableMeasured": "1756 records, 16 wilayas",
20
24
  "distribution": [
21
25
  {
22
26
  "@type": "DataDownload",
@@ -29,12 +33,43 @@
29
33
  "name": "lines (CSV)",
30
34
  "encodingFormat": "text/csv",
31
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"
32
54
  }
33
55
  ],
34
- "dateModified": "2026-07-01",
56
+ "dateModified": "2026-09-04",
35
57
  "url": "https://geoalgeria.com",
36
58
  "sameAs": "https://github.com/yasserstudio/geoalgeria",
37
59
  "citation": [
38
- "French Wikipedia — Lignes de bus ETUSA de 1 à 99 — CC BY-SA 4.0"
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)"
39
74
  ]
40
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": "2.0.0",
3
+ "version": "2.1.1",
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": {
@@ -14,8 +14,10 @@
14
14
  },
15
15
  "files": [
16
16
  "dataset-metadata.json",
17
+ "NOTICE",
17
18
  "data/**/*.json",
18
19
  "data/**/*.csv",
20
+ "data/**/*.geojson",
19
21
  "types/",
20
22
  "index.js"
21
23
  ],
@@ -37,7 +39,7 @@
37
39
  "dz"
38
40
  ],
39
41
  "author": "Yasser's Studio (https://yasser.studio)",
40
- "license": "MIT",
42
+ "license": "SEE LICENSE IN LICENSE",
41
43
  "publishConfig": {
42
44
  "access": "public"
43
45
  },
package/types/index.d.ts CHANGED
@@ -1,113 +1,229 @@
1
- // Type definitions for @geoalgeria/buses (schema v2).
2
- // Algeria's urban bus networks (line-level). Multi-operator by design;
3
- // today's snapshot covers ETUSA (Alger) only, sourced from French Wikipedia.
4
-
5
- /** Coordinate provenance, coarse-grained. Detail lives in `geo_method`.
6
- * `null` when the record carries no coordinate at all. */
7
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
+ }
8
21
 
9
- /** How the coordinate was obtained. Always null today: this dataset is
10
- * line-level, with no per-line geometry. */
11
- export type GeoMethod = null;
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
+ }
12
30
 
13
- /** An urban bus line. */
14
31
  export interface BusLine {
15
- /** Stable id, `{operator}-{line}` (e.g. "etusa-1"). */
16
32
  id: string;
17
- /** Display name: `Ligne {line} — {terminus1} ↔ {terminus2}`. */
18
- name: string;
19
- /** Wilaya code, zero-padded to 2 digits ("16" for Alger). */
33
+ name: string | null;
34
+ name_fr?: string;
35
+ name_ar?: string;
20
36
  wilaya_code: string;
21
- /** Always null — a line spans several communes, see `communes_served`. */
22
37
  commune_code: null;
23
- /** Always null — see `commune_code`. */
24
38
  commune: null;
25
- /** Always null — this dataset is line-level, with no per-line geometry. */
26
39
  lat: null;
27
- /** Always null — see `lat`. */
28
40
  lng: null;
29
- /** Always null: the record carries no point at all, so it asserts no precision. */
30
41
  geo_precision: null;
31
- /** Always null — see `geo_precision`. */
32
- geo_method: GeoMethod;
33
- /** Provenance key into `metadata.sources[]` — always "wikipedia". Not a
34
- * URL; see `source_url` for that. */
35
- source: "wikipedia";
36
- /** Operating company (e.g. "ETUSA"). Not narrowed to a literal union —
37
- * this dataset is designed to cover multiple operators over time. */
42
+ geo_method: null;
43
+ source: SourceKey;
44
+ operator_id: string;
38
45
  operator: string;
39
- /** Network / city (e.g. "Alger"). */
40
46
  network: string;
41
- /** Line number/label as published (e.g. "1", "16B"). */
42
47
  line: string;
43
- /** First terminus. */
44
- terminus1: string;
45
- /** Second terminus. */
46
- terminus2: string;
47
- /** Number of stops where published, or null. */
48
+ terminus1: string | null;
49
+ terminus1_fr?: string;
50
+ terminus1_ar?: string;
51
+ terminus2: string | null;
52
+ terminus2_fr?: string;
53
+ terminus2_ar?: string;
48
54
  stops: number | null;
49
- /** Communes served (French display names). */
55
+ major_stops: number | null;
56
+ service_hours: BusServiceHours[];
57
+ departure_schedules?: BusDepartureSchedule[];
58
+ route_diagram_url?: string | null;
50
59
  communes_served: string[];
51
- /** Metro/tram/gare stations served en route (French display names). */
52
60
  stations_served: string[];
53
- /** URL of the source page the line was read from. */
54
- source_url: string;
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;
118
+ wilaya_code: 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";
55
157
  }
56
158
 
57
- /** One provenance entry in `metadata.sources[]`. */
58
159
  export interface SourceRef {
59
160
  key: string;
60
161
  name: string;
61
162
  url?: string;
62
163
  license: string;
63
- retrieved?: string;
64
- evidence_type?: "official" | "crowdsourced" | "derived";
164
+ retrieved: string;
165
+ evidence_type: "official" | "crowdsourced" | "derived";
65
166
  }
66
167
 
67
- /** Dataset metadata (data/metadata.json). */
68
168
  export interface Metadata {
69
169
  package: "@geoalgeria/buses";
70
- schema_version: string;
170
+ schema_version: "2.0.0";
71
171
  title_fr: string;
72
172
  title_ar: string;
73
173
  title_en: string;
74
174
  record_count: number;
75
- /** Always 0 — no coordinates exist for this dataset. */
175
+ entities: { file: string; count: number }[];
76
176
  geocoded_count: number;
77
177
  geocoded_pct: number;
78
178
  precision: { exact: number; approximate: number };
79
- /** Estimated size of ETUSA's full passenger network (~122 lines). */
80
- estimated_universe: number | null;
81
- coverage_pct: number | null;
179
+ estimated_universe: null;
180
+ coverage_pct: null;
82
181
  coverage_note: string;
83
182
  wilayas_covered: number;
84
- /** Always null — no coordinates exist for this dataset. */
85
- bbox: [number, number, number, number] | null;
183
+ bbox: [number, number, number, number];
86
184
  sources: SourceRef[];
87
185
  license: string;
88
- /** ISO date (YYYY-MM-DD) the dataset was regenerated. */
89
186
  updated: string;
90
187
  operators: string[];
91
188
  by_operator: Record<string, number>;
92
189
  with_stop_count: number;
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;
93
197
  }
94
198
 
95
- /** All bus lines. */
96
199
  export function lines(): BusLine[];
97
- /** One line by id, or null. */
98
200
  export function lineById(id: string): BusLine | null;
99
- /** Lines for an operator (case-insensitive). */
201
+ export function linesByWilaya(code: string | number): BusLine[];
100
202
  export function linesByOperator(operator: string): BusLine[];
101
- /** Distinct operators present. */
203
+ /** Backward-compatible list of Operator display labels. */
102
204
  export function operators(): string[];
103
- /** 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[];
104
218
  export function metadata(): Metadata;
105
219
 
106
220
  declare const _default: {
107
- lines: typeof lines;
108
- lineById: typeof lineById;
109
- linesByOperator: typeof linesByOperator;
110
- 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;
111
227
  metadata: typeof metadata;
112
228
  };
113
229
  export default _default;