แผนที่จาก GPKG + บทความ 6 ชิ้น + ลดความหนา footer
== แผนที่ / GIS ==
- qgis-to-web.py: อ่าน GPKG ได้ (--from gpkg) + เพิ่ม dream-Watcharapol
- เพิ่ม dream-*.geojson 6 ไฟล์ (เส้นทางที่เสนอ: บ้านภาชี · ชานเมืองอยุธยา · HSR · เมืองทองธานี · ปากเกร็ด · วัชรพล)
- map.js: ATMap.proposal() วาดเส้นจริงจาก geojson (ไม่ใช่เส้นตรง) · smoothFactor 0.5
· coordOf() รับ coords=[lat,lng] · fitAll รับได้ทั้งจุดเดี่ยวและเส้น · setStyle บน featureGroup
== บทความ (blog) ==
- text3: ถ้าผมได้ออกแบบสายเดินรถเอง (จาก mydream.html) TH+EN
- text4: วิธีเดินทางไปสถานีรถไฟ และสนามบิน (จาก train-airplane.html) TH+EN
- text5/text6: โครงเปล่ารอเติมเนื้อหา (แสวงหา-โพธิ์ทอง · อำเภอเข้าเมือง)
- แผนที่ความฝัน: map.groups 3 กลุ่ม · คลิกเส้น/หมุด/แถวได้ · ป้ายที่มา
- ย่อหน้า: ระยะห่าง 20px + ย่อหน้าหน้าบรรทัด 1.5em
== ตารางเดินรถ ==
- เปลี่ยนชื่อคีย์ dir_* -> direction_* ทุกไฟล์ (backward-compat ในโค้ด)
- 1011: จุดย่อย 2 ทิศ + offsets [0,25,55]
- 954/2194: จุดย่อย station 8 + offsets
- refreshHighlights: วนข้ามวันเมื่อเลยเที่ยวสุดท้าย + ไฮเทลต์ชิปทุกจุด
- 8 other_stop.md: อัปเดตตรงข้อมูลจริง 8 รายการ
== i18n ==
- แยกไฟล์ต่อภาษา ui/locales/{th,en}.json + i18n.js = loader (ลด 28KB -> 6.5KB)
- resource/tools/check-i18n.py ตรวจคีย์ขาด/ซ้ำ
- ข้อความผู้สนับสนุนหน้าแรก + คำแปล EN
== UI ==
- ฝังฟอนต์ K2D (ui/vendor/fonts/) ออฟไลน์ 100%
- cache busting ?v=<SW VERSION> ทุกรูป (ui/imageurl.js)
- footer: ลดความหนา 468 -> 349px + line-height 1.5 กันสระ/วรรณยุกต์ซ้อน
- QR modal + ปุ่มคัดลอกลิงก์ · หน้าอัปเดตล่าสุดใน #/check
- credits: ขอขอบคุณภาพรถ 3 สาย
== เครื่องมือ ==
- bump-version.py · stamp-schedules.py · derive-times.py (จุดอ้างอิง ± นาที)
This commit is contained in:
1 parent
1cfaeb1526
commit
656f65b41c
109 files changed
+3335
-1225
No files matched your search
@@ -63,7 +63,7 @@
|
||||
"offsets_min": [
|
||||
0,
|
||||
45,
|
||||
null,
|
||||
60,
|
||||
null
|
||||
]
|
||||
},
|
||||
@@ -110,16 +110,46 @@
|
||||
"longitude": [
|
||||
100.41580160519578,
|
||||
100.46123794436457
|
||||
],
|
||||
"offsets_min": [
|
||||
0,
|
||||
30
|
||||
]
|
||||
},
|
||||
{
|
||||
"route_id": "1101",
|
||||
"station_name_th": "วัดสีบัวทอง",
|
||||
"route_id": "1011",
|
||||
"station_name_th": [
|
||||
"วัดสีบัวทอง",
|
||||
"ตลาดแสวงหา",
|
||||
"ตลาดสดเทศบาลตำบลโพธิ์ทอง"
|
||||
],
|
||||
"city_th": "แสวงหา",
|
||||
"province_th": "อ่างทอง",
|
||||
"station_type": "local_stop",
|
||||
"latitude": 14.787802367428677,
|
||||
"longitude": 100.23218786664407
|
||||
"latitude": [
|
||||
14.787802367428677,
|
||||
14.749622456669288,
|
||||
14.661318107670693
|
||||
],
|
||||
"longitude": [
|
||||
100.23218786664407,
|
||||
100.32660174886443,
|
||||
100.40858605122014
|
||||
],
|
||||
"offsets_min": [
|
||||
0,
|
||||
25,
|
||||
55
|
||||
]
|
||||
},
|
||||
{
|
||||
"route_id": "641",
|
||||
"station_name_th": "7-11 บ้านแพรก",
|
||||
"city_th": "บ้านแพรก",
|
||||
"province_th": "อยุธยา",
|
||||
"station_type": "local_stop",
|
||||
"latitude": 14.648426896998021,
|
||||
"longitude": 100.57918677073818
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
> 📌 **ไฟล์นี้เป็นบันทึกของเจ้าของข้อมูล ไม่ใช่ข้อมูลสำหรับเว็บ** — เว็บอ่านเฉพาะ `8 other_stop.json`
|
||||
> ไฟล์นี้มีไว้กันการ "ช่วยเติมข้อมูล" ที่ไม่ได้รับอนุญาต (เช่น AI หรือผู้พัฒนาที่เข้ามาทีหลัง)
|
||||
|
||||
อัปเดตล่าสุด: **2026-09-26** · ผู้ตัดสินใจ: เจ้าของข้อมูล (ทีม Atroute)
|
||||
อัปเดตล่าสุด: **2026-10-05** · ผู้ตัดสินใจ: เจ้าของข้อมูล (ทีม Atroute)
|
||||
|
||||
---
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
ซึ่งเป็น**ชื่อรวม**ของทุกสายที่ไม่ได้ขึ้นที่สถานีหลัก — ของจริงของแต่ละสายอยู่ใน `8 other_stop.json` เช่น
|
||||
|
||||
```json
|
||||
{ "route_id": "1101", "station_name_th": "วัดสีบัวทอง", "city_th": "แสวงหา", "province_th": "อ่างทอง",
|
||||
"station_type": "local_stop", "latitude": 14.787802367428677, "longitude": 100.23218786664407 }
|
||||
{ "route_id": "2231", "station_name_th": "วัดมหานาม", "city_th": "ไชโย", "province_th": "อ่างทอง",
|
||||
"station_type": "local_stop", "latitude": 14.712584910077634, "longitude": 100.44760308824014 }
|
||||
```
|
||||
|
||||
หน้าเว็บ (`#/stops/other_stop?route=1011`) จะขึ้น **"จุดขึ้นรถประจำทางอื่นๆ · วัดสีบัวทอง"** โดยจับคู่จากไฟล์นี้
|
||||
@@ -22,56 +22,58 @@
|
||||
|
||||
---
|
||||
|
||||
## 2. ⛔ ห้ามเพิ่ม 7 สายนี้ (เจ้าของข้อมูลกำหนด)
|
||||
## 2. ⛔ ห้ามเพิ่ม 5 สายนี้ (เจ้าของข้อมูลกำหนด)
|
||||
|
||||
| สาย | ชื่อสาย | มี`station_id 8` ในเส้นทางไหม | สถานะข้อมูลของจุดนั้น | คำสั่ง |
|
||||
| ------------- | ------------------------------------------------ | --------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
||||
| | | | | |
|
||||
| **952** | กรุงเทพ-วิเศษชัยชาญ | มี (จุดที่ 3/3) | มีเวลา 3 เที่ยว แต่ยังไม่ระบุชื่อจุดจริง | ⛔ ห้ามเพิ่ม entry (อย่าเพิ่มเพราะเห็นว่ามีเวลา) |
|
||||
| **641** | อ่างทอง-บ้านแพรก-ลพบุรี | มี (จุดที่ 3/3) | ยังไม่มีข้อมูลเวลาที่จุดนี้ | ⛔ ห้ามเพิ่ม entry |
|
||||
| **15** | กรุงเทพ-อ่างทอง สายใน | ไม่มี | — | ⛔ ห้ามเพิ่ม — เพิ่มไปก็ไม่แสดงผล |
|
||||
| **902** | กรุงเทพ-อ่างทอง สายเอเซีย | ไม่มี | — | ⛔ ห้ามเพิ่ม — เพิ่มไปก็ไม่แสดงผล |
|
||||
| **464** | สุพรรณ-อ่างทอง-สระบุรี | ไม่มี | — | ⛔ ห้ามเพิ่ม — เพิ่มไปก็ไม่แสดงผล |
|
||||
| **101** | อ่างทอง-ป่าโมก-อยุธยา | ไม่มี | — | ⛔ ห้ามเพิ่ม — เพิ่มไปก็ไม่แสดงผล |
|
||||
| สาย | ชื่อสาย | มี `station_id 8` ในเส้นทางไหม | สถานะข้อมูลของจุดนั้น | คำสั่ง |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| **952** | กรุงเทพ-วิเศษชัยชาญ | มี (จุดที่ 3/3) | มีเวลา 3 เที่ยว แต่ยังไม่ระบุชื่อจุดจริง | ⛔ ห้ามเพิ่ม entry (อย่าเพิ่มเพราะเห็นว่ามีเวลา) |
|
||||
| **15** | กรุงเทพ-อ่างทอง สายใน | ไม่มี | — | ⛔ ห้ามเพิ่ม — เพิ่มไปก็ไม่แสดงผล |
|
||||
| **902** | กรุงเทพ-อ่างทอง สายเอเซีย | ไม่มี | — | ⛔ ห้ามเพิ่ม — เพิ่มไปก็ไม่แสดงผล |
|
||||
| **464** | สุพรรณ-อ่างทอง-สระบุรี | ไม่มี | — | ⛔ ห้ามเพิ่ม — เพิ่มไปก็ไม่แสดงผล |
|
||||
| **101** | อ่างทอง-ป่าโมก-อยุธยา | ไม่มี | — | ⛔ ห้ามเพิ่ม — เพิ่มไปก็ไม่แสดงผล |
|
||||
|
||||
**ผลเมื่อไม่มี entry:** หน้าเว็บยังทำงานปกติ — แถวของสายนั้นจะแสดงตำแหน่งในเส้นทางแทน
|
||||
(เช่น `จุดจอดที่ 3/3` หรือ `Passing · 4/5`) **ไม่ใช่ข้อผิดพลาด** และไม่ต้องไปเติมให้ครบ
|
||||
|
||||
---
|
||||
|
||||
## 3. ✅ 6 รายการที่มีอยู่แล้ว — ห้ามลบ
|
||||
## 3. ✅ 8 รายการที่มีอยู่แล้ว — ห้ามลบ
|
||||
|
||||
| `route_id` ในไฟล์ | ใช้กับสาย | ชื่อจุดจริง | อำเภอ/จังหวัด |
|
||||
| ------------------------- | ------------------ | ------------------------ | -------------------------------------------------- |
|
||||
| `2231` | 2231 | วัดมหานาม | ไชโย · อ่างทอง |
|
||||
| `324` | 324 | วัดไชโย | ไชโย · อ่างทอง |
|
||||
| `954` | 954 | ตลาดท่าช้าง | เดิมบางนางบวช · สุพรรณบุรี |
|
||||
| `8` | 8 | ตลาดสรรคบุรี | สรรคบุรี · ชัยนาท |
|
||||
| `2194` | 2194 | วัดหัวเวียง | เสนา · อยุธยา |
|
||||
| **`1101`** | **1011** | วัดสีบัวทอง | แสวงหา · อ่างทอง |
|
||||
| `route_id` ในไฟล์ | ใช้กับสาย | ชื่อจุดจริง (จุดแรก) | อำเภอ/จังหวัด | จำนวนจุด · offsets_min |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `2231` | 2231 | วัดมหานาม | ไชโย · อ่างทอง | 1 จุด |
|
||||
| `324` | 324 | วัดไชโย | ไชโย · อ่างทอง | 1 จุด |
|
||||
| `951` | 951 | ตลาดวิเศษชัยชาญ | เดิมบางนางบวช · สุพรรณบุรี (จุดแรก) | 2 จุด · ยังไม่ระบุ offset |
|
||||
| `954` | 954 | ตลาดท่าช้าง | เดิมบางนางบวช · สุพรรณบุรี | 4 จุด · offsets `[0, 45, 60, null]` |
|
||||
| `8` | 8 | ตลาดสรรคบุรี | สรรคบุรี · ชัยนาท (จุดแรก) | 3 จุด · ยังไม่ระบุ offset |
|
||||
| `2194` | 2194 | วัดหัวเวียง | เสนา · อยุธยา | 2 จุด · offsets `[0, 30]` |
|
||||
| `1011` | 1011 | วัดสีบัวทอง | แสวงหา · อ่างทอง | 3 จุด · offsets `[0, 25, 55]` |
|
||||
| `641` | 641 | 7-11 บ้านแพรก | บ้านแพรก · อยุธยา (จุดแรก) | 1 จุด |
|
||||
|
||||
> ⚠️ `1101` **ไม่ใช่รหัสสายจริง** — เป็นรหัสที่ระบบเดิมใช้แทนสาย **1011**
|
||||
> โค้ดรองรับไว้แล้ว (เทียบแบบ "ตัวเลขชุดเดียวกัน สลับตำแหน่ง" เฉพาะรหัส ≥3 หลัก และหาคู่ได้ไม่กำกวม)
|
||||
> จะแก้เป็น `"1011"` ก็ได้ (โค้ดรองรับทั้งสองแบบ) แต่ **ห้ามลบ** เพราะจุดนี้เป็นของสาย 1011
|
||||
**หมายเหตุ:** `route_id` ในไฟล์ **ตรงกับรหัสสายจริงทุกตัว** — เดิมมี `1101` ซึ่งเป็นรหัสเพี้ยนของสาย `1011` แก้เป็น `1011` แล้ว
|
||||
|
||||
---
|
||||
|
||||
## 4. กติกาที่โค้ดใช้จับคู่ (`ui/partials/otherStop.js`)
|
||||
|
||||
1. **ตรงตัวก่อน** — `route_id` ในไฟล์ตรงกับรหัสสายจริง → ใช้เลย
|
||||
2. **ไม่ตรง → เทียบแบบสลับตำแหน่งตัวเลข** เฉพาะรหัส **≥3 หลัก** และต้องหาคู่ได้ **ตัวเดียว** → `1101 → 1011` ✅
|
||||
2. **ไม่ตรง → เทียบแบบสลับตำแหน่งตัวเลข** เฉพาะรหัส **≥3 หลัก** และต้องหาคู่ได้ **ตัวเดียว**
|
||||
(ชั้นนี้เป็น "ตัวกันพลาด" สำหรับรหัสที่พิมพ์สลับหลักในอนาคต · ค่าจริงในไฟล์ใช้รหัสตรงแล้วทุกตัว)
|
||||
3. **ไม่รู้จัก / กำกวม → ไม่เดา** (คืนค่าว่าง แล้ว UI ถอยไปแสดงตำแหน่งในเส้นทาง) — เช่น `51` จะไม่ถูกจับเป็น `15`
|
||||
|
||||
## 5. ถ้าอนาคตจะเพิ่มรายการใหม่ (ต้องได้รับการยืนยันจากเจ้าของข้อมูลก่อน)
|
||||
|
||||
คีย์ที่ต้องมี: `route_id`, `station_name_th`, `city_th`, `province_th`, `station_type` (`local_stop`), `latitude`, `longitude` (+ `note` ถ้ามี)
|
||||
คีย์ที่ต้องมี: `route_id`, `station_name_th`, `city_th`, `province_th`, `station_type` (`local_stop`), `latitude`, `longitude`
|
||||
คีย์เพิ่มเติม: `offsets_min` (array · นาทีจากจุดแรก · `0` = จุดแรกเอง · `null` = ยังไม่ระบุ) · `note` (ถ้ามี)
|
||||
|
||||
หลังเพิ่ม: หน้า `#/stops/other_stop?route=<รหัสสาย>` ต้องขึ้นชื่อจุดนั้นทันที · และ `#/routes/<รหัสสาย>` จะแสดงจุดนั้นพร้อม กม. ตามเส้นทาง
|
||||
|
||||
**ข้อห้าม:** อย่าเพิ่มรายการเพราะ "เห็นว่ายังไม่มี" — ถ้าไม่มีในตาราง §3 แปลว่ายังไม่ได้รับข้อมูลจากเจ้าของ
|
||||
|
||||
## 6. กติกา "หลายจุดต่อสาย" (สำคัญ — เจ้าของข้อมูลกำหนด)
|
||||
|
||||
สายเดียวผ่านได้หลายจุด (เช่น **954** = ตลาดท่าช้าง · ตลาดสามโก้ · ตลาดวิเศษชัยชาญ · ตลาดอ่างทอง)
|
||||
สายเดียวผ่านได้หลายจุด (เช่น **954** = ตลาดท่าช้าง · ตลาดสามโก้ · ตลาดวิเศษชัยชาญ · ตลาดอ่างทอง
|
||||
หรือ **1011** = วัดสีบัวทอง · ตลาดแสวงหา · ตลาดสดเทศบาลตำบลโพธิ์ทอง)
|
||||
|
||||
```json
|
||||
"station_name_th": ["ตลาดท่าช้าง", "ตลาดสามโก้", "ตลาดวิเศษชัยชาญ", "ตลาดอ่างทอง"],
|
||||
@@ -84,9 +86,11 @@
|
||||
- ตัวอย่าง array: สาย 8 → `latitude: [15.0474, 14.7497, 14.6603]` + 4 ชื่อ → ชื่อที่ 4 (ตลาดอ่างทอง) ยังไม่มีพิกัด
|
||||
- **ชื่อที่เกินจำนวนพิกัด = ยังไม่มีพิกัด** → เว็บแสดงชื่อพร้อมป้าย "ยังไม่มีพิกัด" (ไม่ซ่อน ไม่เดา)
|
||||
- `city_th`/`province_th` ในไฟล์อธิบาย **จุดแรก** เท่านั้น (จุดอื่นไม่ทราบ)
|
||||
- `offsets_min` = **นาทีจากจุดแรก** (ไม่ใช่จากจุดก่อนหน้า) → จุดแรกเป็น `0` เสมอ
|
||||
|
||||
**การแสดงผล:** `#/stops/other_stop?route=954` → แสดง "จุดขึ้นรถประจำทางอื่นๆ · ตลาดท่าช้าง" (ชื่อย่อ = จุดแรก)
|
||||
+ รายการ **ทุกจุด** ของสายนั้น (แถวที่ไม่มีพิกัดขึ้นป้ายเตือน) · แผนที่ปักหมุดเฉพาะจุดที่มีพิกัด
|
||||
+ หน้า `#/check/<สาย>` แสดงการ์ดย่อยของแต่ละจุด พร้อมเวลาที่คำนวณจากจุดอ้างอิงตาม `offsets_min`
|
||||
|
||||
**ข้อสังเกตของเจ้าของข้อมูล (ยังไม่แก้ ต้องยืนยัน):**
|
||||
- สาย **951** และ **954** มีค่า `latitude/longitude` **เท่ากันเป๊ะ** (14.651061064977933, 100.14903762295052)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
|
||||
Binary file not shown.
Binary file not shown.
@@ -2,7 +2,7 @@
|
||||
"route_id": "101",
|
||||
"vehicle_image": "car.jpeg",
|
||||
"qr_image": "101.png",
|
||||
"vehicle_title": "รถปรับอากาศ · ไม่สูบบุหรี่",
|
||||
"vehicle_desc": "40 ที่นั่ง · ให้บริการตลอดเส้นทางอ่างทอง–ป่าโมก–อยุธยา พร้อมที่วางสัมภาระและแอร์เย็นฉ่ำ",
|
||||
"line_note": "ติดตามข่าวสาย 101 · เลื่อนเวลา · ไม่มีรถ"
|
||||
"vehicle_title": "รถสองแถวประจำเส้นทาง",
|
||||
"vehicle_desc": "ประมาณ 30 ที่นั่ง · ให้บริการตลอดเส้นทางอ่างทอง–ป่าโมก–อยุธยา",
|
||||
"line_note": "ติดตามข่าวสาย 101 · รถออกก่อนเวลาบ่อยครั้ง · รถขาดช่วง"
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"route_id": "1011",
|
||||
"vehicle_image": "car.jpeg",
|
||||
"qr_image": "",
|
||||
"vehicle_title": "",
|
||||
"vehicle_desc": "",
|
||||
"vehicle_title": "รถเมล์ประจำเส้นทาง",
|
||||
"vehicle_desc": "รถเมล์ ประมาณ 30 ที่นั่ง รถมีเที่ยว เช้า เที่บง เย็น",
|
||||
"line_note": ""
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"route_id": "15",
|
||||
"vehicle_image": "car.jpg",
|
||||
"qr_image": "15.JPG",
|
||||
"vehicle_title": "",
|
||||
"vehicle_desc": "",
|
||||
"vehicle_title": "รถมินิบัส 20 ที่นั่ง",
|
||||
"vehicle_desc": "ปัจจุบันส่วนใหญ่วิ่งแค่ป่าโมก หมอชิตใหม่ เหลือแค่รถ เบอร์ 20 ที่กลับถึงอ่างทอง บขส.อ่างทองมีรถออกแค่เช้ามืดถึงโมงเช้า",
|
||||
"line_note": ""
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"route_id": "2194",
|
||||
"vehicle_image": "car.jpg",
|
||||
"qr_image": "",
|
||||
"vehicle_title": "",
|
||||
"vehicle_desc": "",
|
||||
"vehicle_title": "รถสองแถวประจำเส้นทาง",
|
||||
"vehicle_desc": "รถสองแถวเช้ามืดและเย็น ผ่านอ่างทองแค่สามแยกข้ามสะพานโผงเผงและวัดถนน",
|
||||
"line_note": ""
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"route_id": "2231",
|
||||
"vehicle_image": "car.jpg",
|
||||
"qr_image": "",
|
||||
"vehicle_title": "",
|
||||
"vehicle_desc": "",
|
||||
"vehicle_title": "รถสองแถวประจำเส้นทาง",
|
||||
"vehicle_desc": "มีเที่ยวเดียว เช้า-เย็น",
|
||||
"line_note": ""
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"route_id": "324",
|
||||
"vehicle_image": "car.jpg",
|
||||
"qr_image": "",
|
||||
"vehicle_title": "",
|
||||
"vehicle_desc": "",
|
||||
"vehicle_title": "รถสองแถวประจำเส้นทาง",
|
||||
"vehicle_desc": "รถมีเที่ยว เช้า อย่างเดียว วิ่งสุดสายแค่วัดไชโย",
|
||||
"line_note": ""
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"route_id":"dream-Watcharapol"},"geometry":{"type":"LineString","coordinates":[[100.45187,14.59472],[100.44941,14.59352],[100.44782,14.59261],[100.44688,14.5919],[100.44638,14.5913],[100.44607,14.59074],[100.44577,14.59016],[100.44541,14.58959],[100.44499,14.58903],[100.44456,14.58855],[100.44424,14.58816],[100.44404,14.58783],[100.44391,14.58744],[100.44386,14.5869],[100.44393,14.58622],[100.44414,14.58538],[100.44447,14.58433],[100.44486,14.58301],[100.44525,14.58164],[100.44554,14.5806],[100.44568,14.58002],[100.44573,14.57958],[100.44577,14.579],[100.44584,14.57834],[100.44599,14.57778],[100.44621,14.57735],[100.44647,14.57702],[100.44678,14.57671],[100.44714,14.57627],[100.44755,14.57555],[100.448,14.57447],[100.44846,14.57296],[100.44879,14.57118],[100.44878,14.56944],[100.4483,14.56791],[100.44745,14.56651],[100.44635,14.56518],[100.44511,14.56394],[100.44387,14.56285],[100.44283,14.56182],[100.44222,14.56062],[100.44216,14.55913],[100.44251,14.55745],[100.44313,14.55572],[100.44376,14.55405],[100.44418,14.55257],[100.44429,14.55121],[100.44415,14.54981],[100.44384,14.54827],[100.44361,14.54677],[100.44367,14.5454],[100.44414,14.54391],[100.44508,14.54197],[100.44619,14.53958],[100.44687,14.53709],[100.44683,14.53474],[100.44649,14.53267],[100.44629,14.53091],[100.44631,14.52934],[100.44654,14.52775],[100.44718,14.52619],[100.4486,14.52492],[100.45091,14.52402],[100.4536,14.5232],[100.45612,14.52217],[100.45815,14.52095],[100.45945,14.51965],[100.45988,14.51823],[100.45941,14.51655],[100.45815,14.51459],[100.45656,14.51268],[100.4551,14.51111],[100.45389,14.50974],[100.45291,14.50826],[100.45205,14.50658],[100.45112,14.50485],[100.45004,14.50325],[100.449,14.5021],[100.4482,14.50164],[100.44765,14.50145],[100.4473,14.50087],[100.44719,14.49981],[100.44743,14.4987],[100.448,14.49781],[100.44857,14.49702],[100.44879,14.4962],[100.4486,14.49544],[100.44804,14.49495],[100.44725,14.49478],[100.44648,14.49493],[100.44593,14.49531],[100.44564,14.49571],[100.44562,14.49594],[100.44586,14.49597],[100.44629,14.49584],[100.44685,14.49564],[100.44749,14.49547],[100.44811,14.49545],[100.44846,14.49562],[100.44836,14.49602],[100.44783,14.49663],[100.447,14.49736],[100.44607,14.49811],[100.44538,14.49874],[100.44519,14.49914],[100.44571,14.49925],[100.44705,14.49904],[100.44893,14.49852],[100.45087,14.49775],[100.45259,14.49688],[100.45397,14.49616],[100.45501,14.49571],[100.45595,14.49535],[100.45703,14.49488],[100.45837,14.49429],[100.45999,14.49365],[100.46181,14.49302],[100.46361,14.49249],[100.46524,14.4921],[100.46675,14.49177],[100.46821,14.49145],[100.4697,14.49115],[100.47131,14.49091],[100.47315,14.49076],[100.47539,14.49066],[100.47803,14.49058],[100.48053,14.49051],[100.48233,14.49042],[100.48358,14.49032],[100.48475,14.49023],[100.4861,14.49014],[100.48756,14.49001],[100.48908,14.48981],[100.49064,14.48955],[100.49229,14.48924],[100.49435,14.48876],[100.49735,14.48793],[100.50121,14.48675],[100.50521,14.48546],[100.50871,14.4843],[100.51156,14.48335],[100.51375,14.48265],[100.51556,14.48211],[100.51745,14.48151],[100.51959,14.48088],[100.52184,14.4805],[100.524,14.48055],[100.52591,14.48089],[100.52743,14.48127],[100.52866,14.48106],[100.52985,14.47943],[100.53123,14.47619],[100.53305,14.47203],[100.53542,14.46756],[100.53801,14.46297],[100.54045,14.45836],[100.54262,14.45388],[100.54456,14.44967],[100.54653,14.44575],[100.54908,14.44188],[100.55261,14.43786],[100.55694,14.43374],[100.56176,14.42958],[100.56659,14.42549],[100.57087,14.42154],[100.57438,14.41782],[100.57738,14.41441],[100.58021,14.41129],[100.58323,14.40805],[100.5868,14.40423],[100.59075,14.39997],[100.59461,14.39578],[100.59804,14.39195],[100.60095,14.38853],[100.6033,14.38544],[100.60531,14.38245],[100.60722,14.3793],[100.60913,14.37611],[100.61104,14.37326],[100.61283,14.37077],[100.6142,14.36813],[100.61497,14.36488],[100.61533,14.3608],[100.61557,14.35582],[100.61578,14.35034],[100.61591,14.34505],[100.61598,14.33998],[100.61606,14.3341],[100.61623,14.32669],[100.6165,14.31889],[100.61687,14.31214],[100.61722,14.30586],[100.61739,14.2981],[100.61732,14.28866],[100.61718,14.28024],[100.6171,14.27504],[100.61709,14.27196],[100.61708,14.2691],[100.61701,14.26583],[100.61675,14.26241],[100.61631,14.25887],[100.61585,14.2549],[100.61549,14.25036],[100.6152,14.24599],[100.61489,14.24275],[100.61454,14.24043],[100.61413,14.23806],[100.61368,14.23516],[100.61323,14.23223],[100.61279,14.22975],[100.61237,14.22774],[100.61195,14.226],[100.61157,14.22414],[100.61128,14.22154],[100.61109,14.21801],[100.61096,14.21411],[100.61084,14.2104],[100.61075,14.20698],[100.61069,14.20379],[100.61069,14.20094],[100.61074,14.19858],[100.61082,14.19667],[100.61092,14.19479],[100.611,14.19258],[100.61107,14.19023],[100.61113,14.18806],[100.61121,14.18617],[100.61137,14.18447],[100.61165,14.18286],[100.61213,14.18136],[100.61286,14.17998],[100.61379,14.17887],[100.61483,14.17821],[100.Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"route_id":"dream-ayutthaya-hsr"},"geometry":{"type":"LineString","coordinates":[[100.4517,14.59442],[100.45327,14.59087],[100.45425,14.58831],[100.45477,14.58656],[100.45491,14.58544],[100.45481,14.58477],[100.45456,14.58439],[100.45427,14.58411],[100.45401,14.58384],[100.45379,14.58355],[100.4536,14.58323],[100.45345,14.58287],[100.45334,14.58244],[100.45328,14.58193],[100.45327,14.58133],[100.4533,14.58064],[100.45336,14.57989],[100.45345,14.5791],[100.45355,14.57828],[100.45366,14.57745],[100.45377,14.57662],[100.45387,14.57582],[100.45395,14.57504],[100.45403,14.5743],[100.4541,14.5736],[100.45415,14.57293],[100.45418,14.57232],[100.4542,14.57176],[100.4542,14.57125],[100.45418,14.57079],[100.45414,14.57036],[100.45408,14.56997],[100.454,14.56961],[100.45389,14.56927],[100.45376,14.56896],[100.45361,14.56865],[100.45343,14.56836],[100.45323,14.56807],[100.453,14.56778],[100.45275,14.56749],[100.45248,14.56719],[100.45218,14.56688],[100.45188,14.56655],[100.45158,14.56621],[100.45128,14.56584],[100.45099,14.56544],[100.45072,14.56502],[100.45048,14.56456],[100.45026,14.56407],[100.45008,14.56356],[100.44992,14.56303],[100.4498,14.5625],[100.4497,14.56196],[100.44965,14.56141],[100.44962,14.56088],[100.44962,14.56034],[100.44964,14.55981],[100.44967,14.55927],[100.44971,14.55874],[100.44974,14.55821],[100.44977,14.55767],[100.44979,14.55713],[100.44981,14.55659],[100.44981,14.55603],[100.44979,14.55547],[100.44976,14.55488],[100.44972,14.55428],[100.44965,14.55367],[100.44958,14.55305],[100.44951,14.55243],[100.44945,14.55183],[100.44941,14.55125],[100.4494,14.55071],[100.44942,14.5502],[100.44949,14.5497],[100.4496,14.54917],[100.44976,14.54856],[100.44999,14.54785],[100.45029,14.54699],[100.45066,14.54595],[100.4511,14.54473],[100.45159,14.54341],[100.45211,14.54204],[100.45264,14.54069],[100.45316,14.53943],[100.45365,14.53833],[100.4541,14.53742],[100.45452,14.53669],[100.45494,14.53608],[100.45539,14.53554],[100.45591,14.53502],[100.45651,14.53446],[100.45723,14.53381],[100.45807,14.53305],[100.45898,14.53221],[100.45993,14.53133],[100.46086,14.53044],[100.46174,14.52957],[100.46253,14.52877],[100.46318,14.52806],[100.46369,14.52744],[100.4641,14.52689],[100.46442,14.52639],[100.46467,14.52591],[100.46488,14.52545],[100.46506,14.52498],[100.46523,14.52447],[100.46539,14.52391],[100.46553,14.52327],[100.46566,14.52251],[100.46576,14.52162],[100.46583,14.52056],[100.46588,14.51932],[100.46591,14.51793],[100.46591,14.51646],[100.46589,14.51497],[100.46586,14.51353],[100.46582,14.51221],[100.46577,14.51107],[100.4657,14.51016],[100.46561,14.50941],[100.46546,14.50876],[100.46522,14.50816],[100.46489,14.50755],[100.46443,14.50686],[100.46382,14.50604],[100.46308,14.50508],[100.46224,14.50405],[100.46134,14.50298],[100.46043,14.50193],[100.45954,14.50094],[100.4587,14.50006],[100.45795,14.49933],[100.45725,14.49875],[100.45658,14.49831],[100.45589,14.49799],[100.45515,14.4978],[100.45434,14.49773],[100.45341,14.49776],[100.45238,14.49788],[100.45129,14.49805],[100.45021,14.49823],[100.44917,14.49841],[100.44823,14.49853],[100.44744,14.49857],[100.44683,14.49851],[100.4464,14.49836],[100.44613,14.49815],[100.44597,14.49791],[100.44593,14.49768],[100.44596,14.49747],[100.44604,14.49732],[100.44617,14.49723],[100.44632,14.4972],[100.4465,14.49722],[100.4467,14.49727],[100.44691,14.49734],[100.44713,14.49743],[100.44735,14.49751],[100.44758,14.49759],[100.44786,14.49765],[100.4482,14.49768],[100.44863,14.49768],[100.44916,14.49763],[100.44983,14.49752],[100.45063,14.49736],[100.45154,14.49713],[100.45253,14.49685],[100.45358,14.4965],[100.45465,14.4961],[100.45572,14.49564],[100.45676,14.49513],[100.45777,14.49458],[100.45873,14.49401],[100.45965,14.49345],[100.46052,14.49292],[100.46133,14.49243],[100.46208,14.49202],[100.4628,14.49169],[100.46355,14.49144],[100.46441,14.49124],[100.46546,14.49109],[100.46677,14.49097],[100.46841,14.49087],[100.47045,14.49078],[100.47282,14.49069],[100.47541,14.4906],[100.47807,14.49051],[100.48069,14.49042],[100.48314,14.49033],[100.48528,14.49024],[100.48706,14.49014],[100.48859,14.49],[100.49003,14.48979],[100.49152,14.48948],[100.49319,14.48905],[100.49518,14.48846],[100.49763,14.4877],[100.5005,14.48677],[100.50363,14.48575],[100.50686,14.4847],[100.51003,14.48368],[100.51298,14.48276],[100.51556,14.48199],[100.51766,14.48142],[100.51932,14.48105],[100.52064,14.48083],[100.5217,14.48076],[100.52258,14.4808],[100.52337,14.48093],[100.52414,14.48114],[100.52492,14.48139],[100.52571,14.48165],[100.52647,14.4819],[100.5272,14.4821],[100.52787,14.48223],[100.52846,14.48226],[100.52897,14.48215],[100.52943,14.48184],[100.52988,14.48126],[100.53037,14.48034],[100.53094,14.479],[100.53164,14.47718],[100.5325,14.47481],[100.53353,14.47192],[100.53468,14.46865],[100.53589,14.46515],[100.53711,14.46155],[100.53829,14.45802],[100.53937,14.45469],[100.54031,14.45169],[100.54113,14.44901],[100.54187,14.44663],[1Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"route_id":"dream-ayutthaya-redline"},"geometry":{"type":"LineString","coordinates":[[100.45154,14.59393],[100.45284,14.59075],[100.45381,14.58853],[100.45445,14.58704],[100.45476,14.58605],[100.45478,14.58536],[100.45458,14.58485],[100.45425,14.58443],[100.45389,14.58403],[100.45359,14.58357],[100.45335,14.58301],[100.45318,14.58235],[100.45308,14.58157],[100.45304,14.58066],[100.45307,14.57966],[100.45314,14.5786],[100.45325,14.57754],[100.45341,14.57651],[100.45357,14.57549],[100.45373,14.57448],[100.45385,14.57344],[100.4539,14.57234],[100.45386,14.57121],[100.4537,14.57006],[100.4534,14.56892],[100.45293,14.56781],[100.45234,14.5667],[100.4517,14.56554],[100.45109,14.56427],[100.45058,14.56286],[100.45019,14.56133],[100.4499,14.55977],[100.4497,14.55825],[100.44957,14.55685],[100.4495,14.55555],[100.44949,14.55426],[100.44952,14.55289],[100.4496,14.55135],[100.44971,14.54968],[100.44988,14.54799],[100.45012,14.54638],[100.45043,14.54498],[100.45082,14.54379],[100.45127,14.54276],[100.45176,14.54181],[100.45228,14.54089],[100.45281,14.53996],[100.45338,14.53898],[100.45399,14.53795],[100.45464,14.53683],[100.45537,14.53563],[100.4562,14.53436],[100.45718,14.53303],[100.45836,14.53165],[100.45968,14.53025],[100.46106,14.52889],[100.46235,14.52761],[100.46345,14.52647],[100.4643,14.52547],[100.46492,14.52452],[100.46537,14.52353],[100.46566,14.52243],[100.46585,14.52114],[100.46593,14.51969],[100.46592,14.51808],[100.46583,14.51631],[100.46567,14.51442],[100.46543,14.5125],[100.4651,14.51063],[100.46468,14.50889],[100.46416,14.50735],[100.46353,14.50594],[100.46281,14.50463],[100.46198,14.50335],[100.46106,14.5021],[100.46012,14.50094],[100.4592,14.49991],[100.45838,14.49911],[100.45767,14.49856],[100.45698,14.49823],[100.4562,14.49808],[100.45522,14.49807],[100.45398,14.49815],[100.45256,14.49829],[100.45108,14.49844],[100.44963,14.49856],[100.44833,14.49862],[100.44723,14.4986],[100.44639,14.49847],[100.44587,14.49822],[100.44572,14.49784],[100.44593,14.49741],[100.44648,14.49699],[100.44738,14.49668],[100.44857,14.49652],[100.44993,14.49648],[100.45129,14.49651],[100.45249,14.49653],[100.45339,14.4965],[100.45404,14.49641],[100.45455,14.49625],[100.455,14.49603],[100.45547,14.49573],[100.4559,14.49536],[100.45616,14.4949],[100.45614,14.49434],[100.45574,14.49367],[100.45507,14.49289],[100.45429,14.49199],[100.4536,14.49098],[100.45314,14.48987],[100.45295,14.48871],[100.45296,14.48757],[100.45313,14.48652],[100.45342,14.48562],[100.4538,14.48481],[100.45429,14.48396],[100.45491,14.48295],[100.45566,14.48165],[100.45656,14.48007],[100.4576,14.47827],[100.4588,14.47632],[100.46017,14.47427],[100.46165,14.47214],[100.46316,14.46989],[100.4646,14.46751],[100.46591,14.46495],[100.46709,14.46227],[100.46819,14.45952],[100.46929,14.4568],[100.47045,14.45417],[100.47167,14.45167],[100.47292,14.44929],[100.47413,14.44702],[100.47526,14.44485],[100.47633,14.44281],[100.4774,14.44093],[100.47853,14.43927],[100.47978,14.43786],[100.48115,14.43669],[100.48256,14.43568],[100.48391,14.43476],[100.48513,14.43384],[100.48627,14.43285],[100.48752,14.43169],[100.48912,14.4303],[100.49127,14.42859],[100.49396,14.42659],[100.49688,14.42444],[100.49972,14.42233],[100.50213,14.42042],[100.50399,14.41877],[100.50543,14.4173],[100.50663,14.41592],[100.50775,14.41451],[100.5089,14.41306],[100.51006,14.41165],[100.51122,14.41039],[100.51235,14.40938],[100.51345,14.40866],[100.51458,14.40816],[100.51578,14.40778],[100.51712,14.40743],[100.51859,14.40705],[100.52013,14.40662],[100.52164,14.40613],[100.52304,14.40557],[100.52426,14.40494],[100.52532,14.40425],[100.52623,14.40353],[100.527,14.40278],[100.52766,14.40203],[100.52826,14.40126],[100.52885,14.40049],[100.52947,14.39971],[100.53017,14.39891],[100.53092,14.39805],[100.53168,14.39706],[100.53244,14.39591],[100.53316,14.39455],[100.53382,14.39305],[100.53443,14.3915],[100.53497,14.38998],[100.53544,14.38856],[100.53589,14.38721],[100.53636,14.38589],[100.53691,14.38455],[100.53759,14.38316],[100.53841,14.38176],[100.53938,14.3804],[100.54049,14.37914],[100.54175,14.37803],[100.54311,14.37704],[100.5445,14.37613],[100.54588,14.37523],[100.54717,14.37432],[100.54836,14.3734],[100.54942,14.37248],[100.55035,14.3716],[100.55114,14.37076],[100.55178,14.36994],[100.55228,14.36909],[100.55267,14.36816],[100.55296,14.36711],[100.55316,14.36597],[100.55329,14.36479],[100.55337,14.36364],[100.55341,14.36258],[100.55346,14.36165],[100.55355,14.36088],[100.55371,14.36029],[100.55397,14.35993],[100.55433,14.35976],[100.55476,14.35975],[100.55522,14.35984],[100.55569,14.35999],[100.55616,14.36017],[100.55663,14.36034],[100.55712,14.36049],[100.55764,14.36059],[100.55819,14.36062],[100.55876,14.36061],[100.55934,14.36055],[100.55992,14.36045],[100.5605,14.36034],[100.56106,14.36023],[100.56159,14.36012],[100.56207,14.36005],[100.56252,14.36001],[100.56294,14.36001],[100.56338,14.36005],[100.56384,14.36013],[100.56433,Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"route_id":"dream-banchang"},"geometry":{"type":"LineString","coordinates":[[100.45183,14.5947],[100.45203,14.59406],[100.45236,14.59319],[100.45279,14.59214],[100.45328,14.59101],[100.45379,14.58985],[100.45428,14.58874],[100.45472,14.58777],[100.45506,14.58698],[100.45531,14.58639],[100.45547,14.58598],[100.45555,14.5857],[100.45557,14.58552],[100.45552,14.58541],[100.45544,14.58535],[100.45531,14.58528],[100.45517,14.58521],[100.455,14.58511],[100.45482,14.58501],[100.45463,14.58489],[100.45444,14.58476],[100.45426,14.58463],[100.45408,14.58449],[100.45393,14.58434],[100.45378,14.5842],[100.45366,14.58404],[100.45355,14.58388],[100.45345,14.5837],[100.45337,14.58352],[100.45331,14.58333],[100.45326,14.58312],[100.45322,14.58289],[100.45319,14.58265],[100.45318,14.58238],[100.45317,14.58208],[100.45317,14.58175],[100.45318,14.58138],[100.45319,14.58096],[100.4532,14.58051],[100.45321,14.58],[100.45323,14.57946],[100.45326,14.57887],[100.4533,14.57823],[100.45334,14.57755],[100.4534,14.57683],[100.45346,14.57607],[100.45354,14.57527],[100.45361,14.57446],[100.45367,14.57366],[100.45372,14.57287],[100.45375,14.57211],[100.45375,14.5714],[100.45372,14.57075],[100.45365,14.57017],[100.45356,14.56965],[100.45344,14.56919],[100.4533,14.56877],[100.45315,14.56839],[100.45298,14.56805],[100.45281,14.56774],[100.45263,14.56745],[100.45244,14.56717],[100.45224,14.56687],[100.45202,14.56654],[100.45179,14.56616],[100.45153,14.56572],[100.45125,14.5652],[100.45094,14.56459],[100.45061,14.56388],[100.45029,14.56308],[100.44998,14.5622],[100.4497,14.56124],[100.44947,14.56021],[100.4493,14.55911],[100.44921,14.55796],[100.4492,14.55675],[100.44927,14.55549],[100.44941,14.55419],[100.4496,14.55284],[100.44985,14.55145],[100.45015,14.55002],[100.45048,14.54856],[100.45084,14.54707],[100.45126,14.54556],[100.45173,14.54404],[100.45229,14.54252],[100.45293,14.541],[100.45368,14.53949],[100.45455,14.538],[100.45555,14.53653],[100.45665,14.5351],[100.45781,14.53371],[100.45898,14.53237],[100.46013,14.53107],[100.46122,14.52982],[100.46219,14.52863],[100.46302,14.52751],[100.46368,14.52644],[100.4642,14.5254],[100.4646,14.52437],[100.46489,14.52332],[100.4651,14.52224],[100.46524,14.5211],[100.46534,14.51987],[100.4654,14.51856],[100.46543,14.51717],[100.46542,14.51575],[100.46536,14.51431],[100.46525,14.5129],[100.46508,14.51154],[100.46485,14.51025],[100.46454,14.50907],[100.46417,14.50799],[100.46374,14.50699],[100.46325,14.50606],[100.46272,14.50517],[100.46215,14.50431],[100.46155,14.50346],[100.46093,14.50259],[100.46028,14.50173],[100.4596,14.50088],[100.45887,14.50008],[100.4581,14.49937],[100.45727,14.49876],[100.45637,14.49829],[100.45539,14.49799],[100.45435,14.49787],[100.45325,14.4979],[100.45215,14.49804],[100.45107,14.49825],[100.45004,14.4985],[100.44911,14.49875],[100.44831,14.49896],[100.44765,14.4991],[100.44716,14.49915],[100.44679,14.49913],[100.44653,14.49905],[100.44635,14.49891],[100.44624,14.49872],[100.44618,14.4985],[100.44614,14.49824],[100.44612,14.49797],[100.4461,14.49769],[100.44612,14.49742],[100.44615,14.49718],[100.44621,14.49698],[100.44631,14.49683],[100.44644,14.49675],[100.44662,14.49675],[100.44685,14.4968],[100.44713,14.4969],[100.44747,14.49701],[100.44788,14.49711],[100.44838,14.49719],[100.44895,14.49723],[100.44961,14.49719],[100.45036,14.49709],[100.45117,14.49692],[100.45204,14.49669],[100.45293,14.4964],[100.45385,14.49607],[100.45478,14.49569],[100.45569,14.49527],[100.45661,14.49482],[100.45757,14.49435],[100.45864,14.49388],[100.45987,14.49341],[100.4613,14.49295],[100.46299,14.49253],[100.465,14.49214],[100.46736,14.49179],[100.47006,14.49147],[100.47308,14.49112],[100.4764,14.49074],[100.47999,14.49027],[100.48383,14.48969],[100.4879,14.48897],[100.49218,14.48808],[100.49657,14.48705],[100.50099,14.48593],[100.50533,14.4848],[100.50948,14.48371],[100.51333,14.48273],[100.51679,14.48192],[100.51974,14.48134],[100.52215,14.48102],[100.52409,14.48092],[100.52563,14.48099],[100.52685,14.4812],[100.52783,14.4815],[100.52866,14.48185],[100.52939,14.48221],[100.53011,14.48254],[100.53083,14.48283],[100.53154,14.48308],[100.53226,14.48329],[100.53299,14.48345],[100.53372,14.48356],[100.53445,14.48362],[100.53521,14.48362],[100.53596,14.48357],[100.53672,14.48347],[100.53747,14.48333],[100.53819,14.48316],[100.53889,14.48296],[100.53956,14.48273],[100.54017,14.48249],[100.54074,14.48223],[100.54128,14.48194],[100.54178,14.48161],[100.54227,14.48121],[100.54276,14.48074],[100.54325,14.48017],[100.54376,14.4795],[100.54429,14.47871],[100.54485,14.47782],[100.54541,14.47684],[100.54599,14.47581],[100.54656,14.47475],[100.54713,14.47367],[100.54767,14.47261],[100.5482,14.47157],[100.54871,14.47059],[100.54921,14.46967],[100.54974,14.46883],[100.55029,14.46808],[100.5509,14.46743],[100.55157,14.46691],[100.55232,14.46651],[100.55317,14.46625],[100.5541,14.46609],[100.5551,14.466],[100.55616,14.46595],[100.55728,14.4Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"route_id":"dream-muangthong"},"geometry":{"type":"LineString","coordinates":[[100.45127,14.59401],[100.44858,14.59299],[100.4469,14.59218],[100.44609,14.59122],[100.4458,14.59017],[100.44556,14.58927],[100.44521,14.58856],[100.4448,14.58788],[100.44441,14.58716],[100.44414,14.5864],[100.44407,14.5856],[100.44424,14.58468],[100.44462,14.58363],[100.44503,14.58255],[100.44529,14.58153],[100.44551,14.58051],[100.44589,14.57938],[100.44642,14.57806],[100.44693,14.57651],[100.44734,14.57482],[100.44767,14.5732],[100.44785,14.57171],[100.44759,14.57002],[100.44673,14.56793],[100.44553,14.56576],[100.44434,14.56383],[100.44342,14.56201],[100.44296,14.55996],[100.44298,14.55768],[100.44334,14.55538],[100.44379,14.55322],[100.44394,14.55133],[100.44363,14.54982],[100.4432,14.54875],[100.44296,14.5481],[100.44298,14.54749],[100.44327,14.54657],[100.44384,14.54529],[100.44463,14.54371],[100.44546,14.54202],[100.44606,14.54045],[100.44642,14.53898],[100.44675,14.53732],[100.44716,14.53537],[100.44751,14.53333],[100.44769,14.5314],[100.44778,14.52977],[100.4479,14.52854],[100.44848,14.52751],[100.44995,14.52641],[100.45211,14.52527],[100.45441,14.52432],[100.45642,14.52362],[100.45788,14.52305],[100.45866,14.52243],[100.45889,14.52146],[100.45871,14.51994],[100.45811,14.518],[100.45716,14.51585],[100.45613,14.51399],[100.45536,14.51291],[100.45487,14.51219],[100.45455,14.51096],[100.45423,14.50915],[100.4537,14.5074],[100.45283,14.50608],[100.4516,14.50504],[100.4501,14.50412],[100.44874,14.50329],[100.44788,14.5025],[100.44743,14.50165],[100.44723,14.50067],[100.44733,14.49966],[100.44786,14.49885],[100.44857,14.49823],[100.44893,14.49762],[100.44865,14.497],[100.44782,14.49656],[100.44669,14.49637],[100.44575,14.49611],[100.4454,14.49552],[100.44529,14.49483],[100.44497,14.49436],[100.44438,14.49413],[100.44365,14.494],[100.44293,14.49385],[100.44236,14.49354],[100.44201,14.49285],[100.44177,14.49152],[100.44166,14.48949],[100.44195,14.48717],[100.44295,14.4849],[100.4449,14.4825],[100.4479,14.4797],[100.45113,14.47665],[100.45346,14.47369],[100.4547,14.47084],[100.45541,14.46791],[100.45591,14.46501],[100.45626,14.46265],[100.4565,14.46114],[100.45666,14.4602],[100.45676,14.45947],[100.45682,14.45849],[100.45682,14.45683],[100.45662,14.45465],[100.456,14.45234],[100.45481,14.45025],[100.45289,14.44877],[100.45048,14.44794],[100.4482,14.44748],[100.44648,14.44716],[100.44522,14.44691],[100.4443,14.44662],[100.44353,14.44608],[100.44275,14.44513],[100.44196,14.44381],[100.4412,14.44232],[100.44044,14.44074],[100.43959,14.43908],[100.43869,14.43745],[100.43791,14.436],[100.43735,14.43479],[100.43695,14.43362],[100.43667,14.43235],[100.43658,14.43094],[100.43676,14.42945],[100.43724,14.428],[100.43805,14.4268],[100.43901,14.42588],[100.43984,14.42523],[100.44044,14.42471],[100.44093,14.42407],[100.44132,14.42322],[100.44149,14.42225],[100.44134,14.42128],[100.44103,14.4204],[100.44072,14.41967],[100.44039,14.41908],[100.43995,14.4186],[100.43942,14.41819],[100.43887,14.41775],[100.43872,14.41705],[100.43975,14.41571],[100.4423,14.41352],[100.44601,14.41048],[100.45042,14.40679],[100.45488,14.40307],[100.45881,14.39989],[100.462,14.39712],[100.46439,14.39444],[100.46606,14.39176],[100.46716,14.38912],[100.4679,14.38663],[100.46851,14.38445],[100.46923,14.38251],[100.47027,14.3804],[100.47172,14.3779],[100.47323,14.37526],[100.47449,14.37282],[100.4757,14.3708],[100.47711,14.36935],[100.47869,14.36833],[100.4802,14.36746],[100.48152,14.36657],[100.48262,14.36556],[100.48353,14.36447],[100.48442,14.36352],[100.48534,14.36287],[100.48611,14.36248],[100.48659,14.36229],[100.48691,14.36226],[100.48728,14.36235],[100.4878,14.36249],[100.48853,14.36262],[100.48947,14.3627],[100.49056,14.36268],[100.49191,14.36261],[100.49391,14.36262],[100.49659,14.36279],[100.4992,14.36301],[100.50112,14.3632],[100.50256,14.36333],[100.50391,14.36341],[100.50509,14.36344],[100.5059,14.36346],[100.50668,14.36343],[100.50817,14.36333],[100.51042,14.36317],[100.51265,14.36305],[100.51435,14.363],[100.51578,14.36299],[100.51717,14.36303],[100.51827,14.36331],[100.51883,14.36399],[100.51925,14.36482],[100.52014,14.36542],[100.52153,14.36574],[100.52306,14.36602],[100.52456,14.36631],[100.52606,14.36648],[100.52749,14.36646],[100.52855,14.36629],[100.52902,14.36599],[100.5291,14.36538],[100.52906,14.36423],[100.52904,14.36218],[100.52915,14.35885],[100.52937,14.35466],[100.52963,14.35051],[100.52991,14.34686],[100.53027,14.34372],[100.53069,14.34097],[100.53102,14.33823],[100.53115,14.33529],[100.53107,14.33245],[100.53083,14.33002],[100.53056,14.32768],[100.53039,14.32492],[100.53027,14.32168],[100.53001,14.31812],[100.52953,14.31444],[100.52882,14.31084],[100.52795,14.30743],[100.52712,14.30418],[100.52651,14.30102],[100.52622,14.29783],[100.52632,14.29452],[100.52683,14.29118],[100.52772,14.28796],[100.52877,14.28506],[100.52965,14.28265],[100.53025,14.28025],[100.53066,14.2Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"route_id":"dream-pakkret"},"geometry":{"type":"LineString","coordinates":[[100.4519,14.59465],[100.45076,14.59403],[100.44969,14.59371],[100.44886,14.59351],[100.44823,14.5933],[100.44764,14.59292],[100.44702,14.59228],[100.44641,14.59131],[100.44584,14.59011],[100.44529,14.58908],[100.44478,14.58846],[100.44435,14.58806],[100.44402,14.58763],[100.44383,14.58701],[100.44381,14.58606],[100.44395,14.58493],[100.44421,14.58392],[100.44451,14.58305],[100.44475,14.58203],[100.44489,14.5807],[100.44504,14.57926],[100.44531,14.57791],[100.44567,14.57681],[100.44607,14.57607],[100.4465,14.57555],[100.44699,14.57499],[100.44752,14.57429],[100.44806,14.57344],[100.44853,14.57248],[100.44885,14.57142],[100.44893,14.5703],[100.44874,14.56916],[100.44825,14.56809],[100.44754,14.56714],[100.44672,14.56636],[100.44585,14.56566],[100.445,14.56486],[100.44422,14.56395],[100.44352,14.56311],[100.44291,14.5624],[100.44239,14.56171],[100.44197,14.56087],[100.44181,14.5598],[100.44206,14.55842],[100.44257,14.55676],[100.44303,14.5549],[100.44329,14.55307],[100.44337,14.55165],[100.44328,14.55074],[100.44304,14.54995],[100.44272,14.54904],[100.44241,14.54808],[100.44225,14.5472],[100.4423,14.54631],[100.44264,14.54526],[100.44331,14.54396],[100.44437,14.54243],[100.44563,14.54078],[100.44668,14.53924],[100.44727,14.5379],[100.44745,14.53651],[100.44734,14.53485],[100.44703,14.53305],[100.44665,14.53132],[100.44633,14.5298],[100.44619,14.52862],[100.44636,14.52778],[100.44694,14.52719],[100.44793,14.52673],[100.44916,14.52632],[100.45051,14.52587],[100.45199,14.52541],[100.45362,14.52498],[100.4552,14.52452],[100.45651,14.52397],[100.45751,14.5233],[100.4583,14.52254],[100.45886,14.52163],[100.45903,14.52053],[100.45874,14.51926],[100.45816,14.51804],[100.45747,14.51707],[100.4566,14.51618],[100.4555,14.51515],[100.4544,14.51413],[100.45368,14.51342],[100.45342,14.51289],[100.45348,14.51206],[100.45365,14.51074],[100.45375,14.50919],[100.45357,14.50766],[100.45301,14.50637],[100.45198,14.50542],[100.45073,14.50467],[100.44957,14.50385],[100.44861,14.50293],[100.44779,14.50199],[100.44711,14.50109],[100.44665,14.50024],[100.44649,14.49948],[100.44672,14.49889],[100.44739,14.49852],[100.44822,14.49821],[100.44889,14.49781],[100.44922,14.49733],[100.4491,14.49688],[100.44858,14.49653],[100.44781,14.4963],[100.44696,14.49617],[100.44618,14.49609],[100.44555,14.49597],[100.44497,14.49567],[100.44435,14.49508],[100.44363,14.49443],[100.44284,14.494],[100.44208,14.49368],[100.4415,14.49306],[100.44116,14.49209],[100.44097,14.49109],[100.44088,14.49021],[100.44089,14.48932],[100.44099,14.48827],[100.44112,14.48722],[100.44121,14.48633],[100.44137,14.48558],[100.44179,14.48484],[100.44247,14.48411],[100.4432,14.48356],[100.4441,14.48294],[100.4458,14.48148],[100.44856,14.47876],[100.45151,14.47559],[100.45377,14.47284],[100.45534,14.47033],[100.45656,14.4676],[100.45748,14.46474],[100.458,14.46217],[100.45815,14.45997],[100.45807,14.45787],[100.45775,14.45562],[100.45689,14.45317],[100.45523,14.4506],[100.45292,14.44839],[100.4502,14.447],[100.44733,14.44633],[100.44453,14.44595],[100.4421,14.44529],[100.44039,14.44368],[100.43943,14.44098],[100.43877,14.43789],[100.43806,14.435],[100.43743,14.43237],[100.43707,14.42997],[100.43716,14.42785],[100.43789,14.42604],[100.43899,14.42445],[100.43997,14.42288],[100.44049,14.42122],[100.44042,14.41955],[100.43983,14.41796],[100.43919,14.41663],[100.43903,14.41565],[100.44,14.41461],[100.44264,14.41305],[100.44623,14.41114],[100.44949,14.4093],[100.45201,14.40773],[100.4541,14.40636],[100.45612,14.40496],[100.45843,14.40306],[100.46118,14.40043],[100.46391,14.39771],[100.46609,14.39553],[100.4676,14.39373],[100.46843,14.39189],[100.46863,14.3897],[100.46827,14.38691],[100.46782,14.38359],[100.46823,14.38011],[100.46997,14.37676],[100.47248,14.37358],[100.47515,14.37062],[100.47766,14.36814],[100.47982,14.36641],[100.48181,14.36524],[100.48397,14.36427],[100.48644,14.36333],[100.48921,14.36249],[100.49228,14.3618],[100.49564,14.36132],[100.49925,14.36107],[100.50286,14.36104],[100.50623,14.36121],[100.50935,14.36159],[100.5123,14.3622],[100.51501,14.36296],[100.51732,14.36372],[100.51935,14.36448],[100.52144,14.36539],[100.5237,14.36643],[100.52564,14.36726],[100.52685,14.3675],[100.5275,14.36698],[100.52786,14.36558],[100.52807,14.36347],[100.52819,14.36092],[100.52829,14.35823],[100.5284,14.35577],[100.52857,14.35376],[100.52875,14.35224],[100.52892,14.35103],[100.52897,14.34948],[100.52883,14.3468],[100.52859,14.34201],[100.52836,14.33419],[100.52821,14.32416],[100.52812,14.31383],[100.52797,14.30447],[100.52747,14.29667],[100.52664,14.29056],[100.52605,14.28546],[100.52622,14.28069],[100.52715,14.2761],[100.52864,14.27158],[100.53031,14.26658],[100.53166,14.26042],[100.53272,14.25296],[100.53392,14.24458],[100.53558,14.236],[100.53775,14.2284],[100.54038,14.22254],[100.54313,14.21777],[100.54564,14.21318],[100.54791,14.20Line truncated
|
||||
@@ -8,7 +8,7 @@
|
||||
"route_group_id": 2,
|
||||
"province_ids": [1, 2, 3, 4],
|
||||
"phone": ["+6684 337 7376", "+6662 381 5828"],
|
||||
"web_url": "https://www.facebook.com/profile.php?id=100063523693753",
|
||||
"web_url": ["facebook","https://www.facebook.com/profile.php?id=100063523693753"],
|
||||
"station_ids": [1, 15, 6]
|
||||
},
|
||||
{
|
||||
@@ -19,7 +19,7 @@
|
||||
"route_group_id": 2,
|
||||
"province_ids": [1, 2, 3, 4],
|
||||
"phone": ["+6693 249 5788"],
|
||||
"web_url": "https://www.facebook.com/groups/1355821444815052",
|
||||
"web_url": ["line","https://line.me/ti/g2/tAJzKxqg-CLv1PJ06PRxlPohHAd3rMOWrVAgMA?utm_source=invitation&utm_medium=link_copy&utm_campaign=default"],
|
||||
"station_ids": [1, 2, 4, 5, 6]
|
||||
},
|
||||
{
|
||||
@@ -30,7 +30,7 @@
|
||||
"route_group_id": 2,
|
||||
"province_ids": [1, 5, 4],
|
||||
"phone": ["+6686 099 4250"],
|
||||
"web_url": "https://www.facebook.com/groups/1323166441639529",
|
||||
"web_url": ["facebook","https://www.facebook.com/groups/1323166441639529"],
|
||||
"station_ids": [9, 5, 6, 8 ]
|
||||
},
|
||||
{
|
||||
@@ -52,7 +52,7 @@
|
||||
"route_group_id": 2,
|
||||
"province_ids": [1, 2, 3, 4, 5],
|
||||
"phone": ["+6690 140 3636"],
|
||||
"web_url": "https://shorturl.asia/Qe0s3",
|
||||
"web_url": ["facebook","https://shorturl.asia/Qe0s3"],
|
||||
"station_ids": [ 5, 6, 8]
|
||||
},
|
||||
{
|
||||
@@ -63,7 +63,7 @@
|
||||
"route_group_id": 2,
|
||||
"province_ids": [1, 2, 3, 4, 8, 9],
|
||||
"phone": ["+6656-412264", "+6686-4491276", "+6688-2716613"],
|
||||
"web_url": "https://linevoom.line.me/user/_ddH8YAybarByo7eVApp-6f0teYGaM0bXI4CLBhE",
|
||||
"web_url": ["www","https://www.chainattour.com/th-th/timetables"],
|
||||
"station_ids": [5, 6, 8, 13]
|
||||
},
|
||||
{
|
||||
@@ -74,7 +74,7 @@
|
||||
"route_group_id": 3,
|
||||
"province_ids": [1, 2],
|
||||
"phone": ["+6664 963 9025"],
|
||||
"web_url": null,
|
||||
"web_url": ["line","https://line.me/ti/g2/u1QdJvWSUV20awFiXVw70AgGIwxXTHuq2W1Vfg?utm_source=invitation&utm_medium=link_copy&utm_campaign=default"],
|
||||
"station_ids": [1, 2, 3]
|
||||
},
|
||||
{
|
||||
@@ -85,7 +85,7 @@
|
||||
"route_group_id": 3,
|
||||
"province_ids": [1, 2, 5, 6],
|
||||
"phone": ["+6699 039 3343", "+6692 482 4781"],
|
||||
"web_url": "https://line.me/ti/g2/tXBwCvja_Ign9PlboFugqx_NJWbxVb31J1TSMQ",
|
||||
"web_url": ["line","https://line.me/ti/g2/tXBwCvja_Ign9PlboFugqx_NJWbxVb31J1TSMQ"],
|
||||
"station_ids": [1, 9, 10]
|
||||
},
|
||||
{
|
||||
@@ -123,7 +123,7 @@
|
||||
},
|
||||
{
|
||||
"route_id": "1011",
|
||||
"route_name_th": "อ่างทอง-สีบัวทอง",
|
||||
"route_name_th": "อ่างทอง-แสวงหา-สีบัวทอง",
|
||||
"vehicle_type": "bus",
|
||||
"route_group": "in_province",
|
||||
"route_group_id": 4,
|
||||
|
||||
@@ -312,17 +312,17 @@
|
||||
if (t - lastSnapAt > 1200) { lastSnapAt = t; snap(); }
|
||||
}
|
||||
|
||||
/* ตรวจจับว่าทิศนี้เป็นตารางของวันไหน (อ่านจาก dir_label + dir_note/note ของทุกจุด)
|
||||
/* ตรวจจับว่าทิศนี้เป็นตารางของวันไหน (อ่านจาก direction_label + direction_note/note ของทุกจุด)
|
||||
- เจอคำฝ่ายเดียว → เสนอตั้ง service ให้ (ไม่ตั้งเอง)
|
||||
- เจอทั้งฝ่ายวันทำงานและวันหยุดในทิศเดียว → เตือนว่าควรแยกเป็นคนละทิศ */
|
||||
var HOLIDAY_WORDS = ['วันหยุด', 'นักขัตฤกษ์', 'เสาร์อาทิตย์', 'เสาร์-อาทิตย์', 'ส-อา', 'ส–อา', 'weekend', 'holiday'];
|
||||
var WEEKDAY_WORDS = ['วันทำงาน', 'จ-ศ', 'จ–ศ', 'จันทร์ถึงศุกร์', 'weekday', 'workday'];
|
||||
function scanWords(d) {
|
||||
var texts = [];
|
||||
if (d.dir_label) texts.push(String(d.dir_label));
|
||||
if (d.direction_label) texts.push(String(d.direction_label));
|
||||
(d.stops || []).forEach(function (s) {
|
||||
if (s.note) texts.push(String(s.note));
|
||||
if (s.dir_note) texts.push(String(s.dir_note));
|
||||
if (s.direction_note) texts.push(String(s.direction_note));
|
||||
});
|
||||
var joined = texts.join(' | ');
|
||||
var low = joined.toLowerCase();
|
||||
@@ -423,7 +423,7 @@
|
||||
var max = known.reduce(function (a, b) { return b.k > a ? b.k : a; }, known[0].k);
|
||||
rel = abs.map(function (k) { return typeof k === 'number' ? (forward ? k : (max - k)) : null; });
|
||||
}
|
||||
return { dir_id: d.dir_id, dir_label: d.dir_label, baseEnd: d.baseEnd, travelMin: d.travelMin, speedKmh: d.speedKmh,
|
||||
return { direction_id: d.direction_id, direction_label: d.direction_label, baseEnd: d.baseEnd, travelMin: d.travelMin, speedKmh: d.speedKmh,
|
||||
autoTimes: d.autoTimes, service: d.service,
|
||||
stops: (d.stops || []).map(function (s, i) {
|
||||
var c = {}; for (var k in s) c[k] = s[k];
|
||||
@@ -646,12 +646,12 @@
|
||||
var rows = [[stationName2(d.stops && d.stops[0] ? d.stops[0].station_id : '') === '—' ? '' : '']];
|
||||
var header = ['station_id', 'station_name'];
|
||||
for (var i = 1; i <= n; i++) header.push('t' + i);
|
||||
header.push('dir_note', 'note');
|
||||
header.push('direction_note', 'note');
|
||||
var out = [header.join(',')];
|
||||
(d.stops || []).forEach(function (s) {
|
||||
var row = [s.station_id, csvCell(stationName2(s.station_id, rid))];
|
||||
for (var i = 0; i < n; i++) row.push(csvCell((s.times || [])[i] || ''));
|
||||
row.push(csvCell(s.dir_note || ''));
|
||||
row.push(csvCell(s.direction_note || ''));
|
||||
row.push(csvCell(s.note || ''));
|
||||
out.push(row.join(','));
|
||||
});
|
||||
@@ -681,7 +681,7 @@
|
||||
var rows = parseCSV(text);
|
||||
if (rows.length < 2) return null;
|
||||
var head = rows[0].map(function (h) { return String(h).trim().toLowerCase(); });
|
||||
var iSid = head.indexOf('station_id'), iNote = head.indexOf('note'), iDir = head.indexOf('dir_note');
|
||||
var iSid = head.indexOf('station_id'), iNote = head.indexOf('note'), iDir = head.indexOf('direction_note');
|
||||
var timeCols = [];
|
||||
head.forEach(function (h, i) { if (/^t\d+$/.test(h)) timeCols.push(i); });
|
||||
if (iSid < 0 || !timeCols.length) return null;
|
||||
@@ -693,7 +693,7 @@
|
||||
var times = timeCols.map(function (i) { return String(row[i] || '').trim(); })
|
||||
.filter(function (x) { return /^\d{1,2}:\d{2}$/.test(x); });
|
||||
stops.push({ station_id: sid, times: times,
|
||||
dir_note: (iDir >= 0 ? (String(row[iDir] || '').trim() || null) : null),
|
||||
direction_note: (iDir >= 0 ? (String(row[iDir] || '').trim() || null) : null),
|
||||
note: (iNote >= 0 ? (String(row[iNote] || '').trim() || null) : null) });
|
||||
}
|
||||
return stops.length ? stops : null;
|
||||
@@ -705,7 +705,7 @@
|
||||
var n = tableMaxCols(d);
|
||||
var head = '<tr><th class="rh">จุดจอด (station_id)</th><th class="rh">กม.</th><th class="rh">ที่มา</th>';
|
||||
for (var c = 1; c <= n; c++) head += '<th class="ch">t' + c + '<button class="mini x" data-act="col-del" data-di="' + di + '" data-col="' + c + '" title="ลบคอลัมน์นี้">×</button></th>';
|
||||
head += '<th class="rh">dir_note</th><th class="rh">note</th><th class="rh">จัดการ</th></tr>';
|
||||
head += '<th class="rh">direction_note</th><th class="rh">note</th><th class="rh">จัดการ</th></tr>';
|
||||
var body = (d.stops || []).map(function (s, si) {
|
||||
var km = (ann.stops[si] || {}).km;
|
||||
var src = (s.times || []).filter(Boolean).length ? 'ตารางจริง' : (d.autoTimes ? 'คำนวณอัตโนมัติ' : 'ว่าง');
|
||||
@@ -719,7 +719,7 @@
|
||||
'<td class="rh"><select data-act="cell-sid" data-di="' + di + '" data-si="' + si + '">' + stationOptions(s.station_id, routeObj(S.routeId)) + '</select></td>' +
|
||||
'<td class="mono ck">' + (typeof km === 'number' ? km : '—') + '</td>' +
|
||||
'<td class="src">' + src + '</td>' + tds +
|
||||
'<td><input data-act="cell-dirnote" data-di="' + di + '" data-si="' + si + '" value="' + esc(s.dir_note || '') + '"></td>' +
|
||||
'<td><input data-act="cell-dirnote" data-di="' + di + '" data-si="' + si + '" value="' + esc(s.direction_note || '') + '"></td>' +
|
||||
'<td><input data-act="cell-note" data-di="' + di + '" data-si="' + si + '" value="' + esc(s.note || '') + '"></td>' +
|
||||
'<td class="ops"><button class="mini" data-act="row-up" data-di="' + di + '" data-si="' + si + '">↑</button>' +
|
||||
'<button class="mini" data-act="row-dn" data-di="' + di + '" data-si="' + si + '">↓</button>' +
|
||||
@@ -743,8 +743,8 @@
|
||||
if (!r) return '<p class="empty">เลือกสายจากด้านซ้าย</p>';
|
||||
return (r.directions || []).map(function (d, di) {
|
||||
return '<section class="tbl-sec">' +
|
||||
'<div class="tbl-head"><strong>ทิศ ' + esc(d.dir_id || ('#' + (di + 1))) + '</strong>' +
|
||||
(d.dir_label ? '<span class="f">' + esc(d.dir_label) + '</span>' : '') +
|
||||
'<div class="tbl-head"><strong>ทิศ ' + esc(d.direction_id || ('#' + (di + 1))) + '</strong>' +
|
||||
(d.direction_label ? '<span class="f">' + esc(d.direction_label) + '</span>' : '') +
|
||||
'<span class="f">' + (d.stops || []).length + ' จุด · ' + trips(d) + ' เที่ยว</span>' +
|
||||
'<span class="f">ใช้กับวัน: ' + esc(d.service || 'ทุกวัน') + '</span>' +
|
||||
(d.autoTimes ? '<span class="chip on">คำนวณอัตโนมัติ</span>' : '') +
|
||||
@@ -998,7 +998,7 @@
|
||||
'<td>' + chips + '</td><td class="f">' + esc(r.note) + '</td></tr>';
|
||||
}).join('');
|
||||
return '<div class="modal" data-act="calc-close"><div class="modal-box" data-stop="1">' +
|
||||
'<div class="modal-head"><strong>ตารางที่คำนวณได้ — สาย ' + esc(S.routeId) + ' · ทิศ ' + esc(d.dir_id || '-') + '</strong>' +
|
||||
'<div class="modal-head"><strong>ตารางที่คำนวณได้ — สาย ' + esc(S.routeId) + ' · ทิศ ' + esc(d.direction_id || '-') + '</strong>' +
|
||||
'<button class="mini" data-act="calc-close">ปิด</button></div>' +
|
||||
'<p class="msg">ใช้เวลาจริงจาก <b>' + esc(stationName(res.base.station_id)) + '</b> (' + res.base.times.length + ' เที่ยว) · ' +
|
||||
'เวลาเดินทาง ' + esc(hm(Number(res.travelMin) || 0)) + ' · ความเร็วที่ได้ ≈ ' + (Math.round(res.kmh * 10) / 10) + ' กม./ชม.' +
|
||||
@@ -1057,7 +1057,7 @@
|
||||
|
||||
function dirHeadLetter(di) { return String.fromCharCode(65 + di); }
|
||||
function colTitle(d) {
|
||||
return (d.dir_label && String(d.dir_label).trim()) ? String(d.dir_label).trim() : (d.dir_id || ('ทิศ ' + dirHeadLetter(d.directions_index || 0)));
|
||||
return (d.direction_label && String(d.direction_label).trim()) ? String(d.direction_label).trim() : (d.direction_id || ('ทิศ ' + dirHeadLetter(d.directions_index || 0)));
|
||||
}
|
||||
function timesToText(times) { return (times || []).join(' '); }
|
||||
|
||||
@@ -1075,7 +1075,7 @@
|
||||
var head = '<tr><th class="rh">จุดจอด (station_order)</th><th class="rh2">กม.</th>' +
|
||||
dirs.map(function (d, di) {
|
||||
return '<th class="ch"><div>' + esc(colTitle(d)) + '</div>' +
|
||||
'<div class="ch-sub">' + esc(d.dir_id || '') + ' · ' + trips(d) + ' เที่ยว' +
|
||||
'<div class="ch-sub">' + esc(d.direction_id || '') + ' · ' + trips(d) + ' เที่ยว' +
|
||||
(d.autoTimes ? ' · คำนวณอัตโนมัติ' : '') + (d.service && d.service !== 'all' ? ' · ' + esc(d.service) : '') + '</div></th>';
|
||||
}).join('') + '<th class="ch ops">จัดการ</th></tr>';
|
||||
|
||||
@@ -1121,8 +1121,8 @@
|
||||
var svc = (d.service || 'all').toLowerCase();
|
||||
return '<div class="dirtool" data-di="' + di + '">' +
|
||||
'<span class="dt-letter">' + dirHeadLetter(di) + '</span>' +
|
||||
'<input class="mono" style="width:120px" data-act="dir-label" data-di="' + di + '" value="' + esc(d.dir_label || '') + '" placeholder="ชื่อคอลัมน์">' +
|
||||
'<input class="mono" style="width:104px" data-act="dir-id" data-di="' + di + '" value="' + esc(d.dir_id || '') + '" placeholder="dir_id">' +
|
||||
'<input class="mono" style="width:120px" data-act="dir-label" data-di="' + di + '" value="' + esc(d.direction_label || '') + '" placeholder="ชื่อคอลัมน์">' +
|
||||
'<input class="mono" style="width:104px" data-act="dir-id" data-di="' + di + '" value="' + esc(d.direction_id || '') + '" placeholder="direction_id">' +
|
||||
'<select data-act="dir-service" data-di="' + di + '">' +
|
||||
'<option value="all"' + (svc === 'all' ? ' selected' : '') + '>ทุกวัน</option>' +
|
||||
'<option value="weekday"' + (svc === 'weekday' ? ' selected' : '') + '>วันทำงาน</option>' +
|
||||
@@ -1229,16 +1229,16 @@
|
||||
function directionHtml(r, d, di) {
|
||||
var t = trips(d);
|
||||
var svc = (d.service || 'all').toLowerCase();
|
||||
var guess = guessService(d); /* เดาจากคำใน dir_label/note ว่าตารางนี้สำหรับวันไหน */
|
||||
var guess = guessService(d); /* เดาจากคำใน direction_label/note ว่าตารางนี้สำหรับวันไหน */
|
||||
var counts = (d.stops || []).map(function (s) { return (s.times || []).length; });
|
||||
var uneven = counts.length > 1 && new Set(counts).size > 1;
|
||||
return '' +
|
||||
'<div class="dir" data-di="' + di + '">' +
|
||||
'<div class="dir-head">' +
|
||||
'<div class="f-id" style="width:150px"><label class="f">dir_id</label>' +
|
||||
'<input class="mono" data-act="dir-id" data-di="' + di + '" value="' + esc(d.dir_id || '') + '"></div>' +
|
||||
'<div class="grow"><label class="f">dir_label (ชื่อทิศที่แสดง เช่น ไปอยุธยา — เว้นว่างได้)</label>' +
|
||||
'<input data-act="dir-label" data-di="' + di + '" value="' + esc(d.dir_label || '') + '"></div>' +
|
||||
'<div class="f-id" style="width:150px"><label class="f">direction_id</label>' +
|
||||
'<input class="mono" data-act="dir-id" data-di="' + di + '" value="' + esc(d.direction_id || '') + '"></div>' +
|
||||
'<div class="grow"><label class="f">direction_label (ชื่อทิศที่แสดง เช่น ไปอยุธยา — เว้นว่างได้)</label>' +
|
||||
'<input data-act="dir-label" data-di="' + di + '" value="' + esc(d.direction_label || '') + '"></div>' +
|
||||
'<div class="f-svc"><label class="f">ใช้กับวัน (service)</label>' +
|
||||
'<select data-act="dir-service" data-di="' + di + '">' +
|
||||
'<option value="all"' + (svc === 'all' ? ' selected' : '') + '>ทุกวัน</option>' +
|
||||
@@ -1286,8 +1286,8 @@
|
||||
'<div class="stop-head">' +
|
||||
'<div class="f-id"><label class="f">จุดจอด (station_id)' + (typeof s.km === 'number' ? ' · กม. ' + s.km : ' · ยังไม่มี กม.') + '</label>' +
|
||||
'<select data-act="stop-sid" data-di="' + di + '" data-si="' + si + '">' + stationOptions(s.station_id, r) + '</select></div>' +
|
||||
'<div class="f-dir"><label class="f">dir_note (ทิศของจุดนี้ — เว้นว่างได้)</label>' +
|
||||
'<input data-act="stop-dirnote" data-di="' + di + '" data-si="' + si + '" value="' + esc(s.dir_note || '') + '"></div>' +
|
||||
'<div class="f-dir"><label class="f">direction_note (ทิศของจุดนี้ — เว้นว่างได้)</label>' +
|
||||
'<input data-act="stop-dirnote" data-di="' + di + '" data-si="' + si + '" value="' + esc(s.direction_note || '') + '"></div>' +
|
||||
'<div class="f-note"><label class="f">note (เงื่อนไข เช่น ไม่วิ่งวันหยุด)</label>' +
|
||||
'<input data-act="stop-note" data-di="' + di + '" data-si="' + si + '" value="' + esc(s.note || '') + '"></div>' +
|
||||
'<button class="mini" data-act="stop-up" data-di="' + di + '" data-si="' + si + '" title="เลื่อนขึ้น">↑</button>' +
|
||||
@@ -1337,24 +1337,24 @@
|
||||
}
|
||||
var seenStops = {};
|
||||
(r.directions || []).forEach(function (d, di) {
|
||||
if (!(d.stops || []).length) out.push({ lv: 'e', rid: rid, msg: 'ทิศ ' + (d.dir_id || di) + ': ไม่มีจุดจอด' });
|
||||
if (!(d.stops || []).length) out.push({ lv: 'e', rid: rid, msg: 'ทิศ ' + (d.direction_id || di) + ': ไม่มีจุดจอด' });
|
||||
var counts = {};
|
||||
(d.stops || []).forEach(function (s, si) {
|
||||
var key = d.dir_id + '#' + s.station_id;
|
||||
if (seenStops[key]) out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + d.dir_id + ': จุด ' + s.station_id + ' (' + stationName(s.station_id) + ') ซ้ำในทิศเดียวกัน' });
|
||||
var key = d.direction_id + '#' + s.station_id;
|
||||
if (seenStops[key]) out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + d.direction_id + ': จุด ' + s.station_id + ' (' + stationName(s.station_id) + ') ซ้ำในทิศเดียวกัน' });
|
||||
seenStops[key] = 1;
|
||||
var p = parseTimes(fmtList(s.times));
|
||||
if (p.bad.length) out.push({ lv: 'e', rid: rid, msg: 'ทิศ ' + d.dir_id + ' จุด ' + s.station_id + ': เวลาผิดรูปแบบ ' + p.bad.join(', ') });
|
||||
if (p.bad.length) out.push({ lv: 'e', rid: rid, msg: 'ทิศ ' + d.direction_id + ' จุด ' + s.station_id + ': เวลาผิดรูปแบบ ' + p.bad.join(', ') });
|
||||
var dup = {}, dd = [];
|
||||
p.ok.forEach(function (t) { if (dup[t] && dd.indexOf(t) === -1) dd.push(t); dup[t] = 1; });
|
||||
if (dd.length) out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + d.dir_id + ' จุด ' + s.station_id + ': เวลาซ้ำ ' + dd.join(', ') });
|
||||
if (!p.ok.length) out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + d.dir_id + ' จุด ' + s.station_id + ' (' + stationName(s.station_id) + '): ยังไม่มีเวลา (เว็บจะขึ้น "ยังไม่มีข้อมูล")' });
|
||||
if (dd.length) out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + d.direction_id + ' จุด ' + s.station_id + ': เวลาซ้ำ ' + dd.join(', ') });
|
||||
if (!p.ok.length) out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + d.direction_id + ' จุด ' + s.station_id + ' (' + stationName(s.station_id) + '): ยังไม่มีเวลา (เว็บจะขึ้น "ยังไม่มีข้อมูล")' });
|
||||
var inOrder = (r.station_order || []).indexOf(Number(s.station_id)) !== -1;
|
||||
if (!inOrder) out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + d.dir_id + ' จุด ' + s.station_id + ': ไม่อยู่ใน station_order' });
|
||||
if (!inOrder) out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + d.direction_id + ' จุด ' + s.station_id + ': ไม่อยู่ใน station_order' });
|
||||
counts[(s.times || []).length] = 1;
|
||||
});
|
||||
if (Object.keys(counts).length > 1) {
|
||||
out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + (d.dir_label || d.dir_id) + ': จำนวนเที่ยวไม่เท่ากันข้ามจุด (' + (d.stops || []).map(function (x) { return x.station_id + '×' + (x.times || []).length; }).join(' · ') + ') — อาจยังแยกทิศไม่ครบ' });
|
||||
out.push({ lv: 'w', rid: rid, msg: 'ทิศ ' + (d.direction_label || d.direction_id) + ': จำนวนเที่ยวไม่เท่ากันข้ามจุด (' + (d.stops || []).map(function (x) { return x.station_id + '×' + (x.times || []).length; }).join(' · ') + ') — อาจยังแยกทิศไม่ครบ' });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1443,7 +1443,7 @@
|
||||
var r = routeObj(S.routeId);
|
||||
var src = r.directions[+t.dataset.di];
|
||||
var copy = JSON.parse(JSON.stringify(src)); /* คัดลอกทั้งทิศ (จุดจอด + เวลา + หมายเหตุ) */
|
||||
copy.dir_id = (src.dir_id || 'dir') + '-copy';
|
||||
copy.direction_id = (src.direction_id || 'dir') + '-copy';
|
||||
delete copy.service; /* ให้ผู้ใช้เลือกวันเอง ไม่เดาให้ */
|
||||
r.directions.splice(+t.dataset.di + 1, 0, copy);
|
||||
toast('ทำสำเนาทิศแล้ว — อย่าลืมตั้ง "ใช้กับวัน" ของทั้งสองทิศ');
|
||||
@@ -1461,13 +1461,13 @@
|
||||
'dir-add': function () {
|
||||
var r = routeObj(S.routeId); snap();
|
||||
r.directions = r.directions || [];
|
||||
r.directions.push({ dir_id: 'new-' + (r.directions.length + 1), dir_label: null, stops: [] });
|
||||
r.directions.push({ direction_id: 'new-' + (r.directions.length + 1), direction_label: null, stops: [] });
|
||||
},
|
||||
'dir-del': function (t) { var r = routeObj(S.routeId); snap(); r.directions.splice(+t.dataset.di, 1); },
|
||||
'dir-up': function (t) { moveDir(+t.dataset.di, -1); },
|
||||
'dir-dn': function (t) { moveDir(+t.dataset.di, 1); },
|
||||
'dir-id': function (t) { var r = routeObj(S.routeId); r.directions[+t.dataset.di].dir_id = t.value; },
|
||||
'dir-label': function (t) { var r = routeObj(S.routeId); var v = t.value.trim(); r.directions[+t.dataset.di].dir_label = v || null; },
|
||||
'dir-id': function (t) { var r = routeObj(S.routeId); r.directions[+t.dataset.di].direction_id = t.value; },
|
||||
'dir-label': function (t) { var r = routeObj(S.routeId); var v = t.value.trim(); r.directions[+t.dataset.di].direction_label = v || null; },
|
||||
'stop-add': function (t) {
|
||||
var r = routeObj(S.routeId); snap();
|
||||
var d = r.directions[+t.dataset.di];
|
||||
@@ -1479,7 +1479,7 @@
|
||||
'stop-up': function (t) { moveStop(+t.dataset.di, +t.dataset.si, -1); },
|
||||
'stop-dn': function (t) { moveStop(+t.dataset.di, +t.dataset.si, 1); },
|
||||
'stop-sid': function (t) { var s = stop(t); s.station_id = Number(t.value); },
|
||||
'stop-dirnote': function (t) { var s = stop(t); var v = t.value.trim(); s.dir_note = v || null; },
|
||||
'stop-dirnote': function (t) { var s = stop(t); var v = t.value.trim(); s.direction_note = v || null; },
|
||||
'stop-note': function (t) { var s = stop(t); var v = t.value.trim(); s.note = v || null; },
|
||||
'stop-times': function (t, quiet) {
|
||||
var s = stop(t);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"schema": 3,
|
||||
"route_id": "101",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"route_name": "อ่างทอง-ป่าโมก-อยุธยา",
|
||||
"station_order": [
|
||||
1,
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "1011",
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
1,
|
||||
8
|
||||
8,
|
||||
1
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "from-1",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-1",
|
||||
"direction_label": "จากบขส.อ่างทอง",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 1,
|
||||
@@ -17,13 +18,15 @@
|
||||
"12:00",
|
||||
"16:00",
|
||||
"17:00"
|
||||
]
|
||||
],
|
||||
"direction_note": "บขส.อ่างทอง → โพธิ์ทอง → แสวงหา → วัดสีบัวทอง"
|
||||
}
|
||||
]
|
||||
],
|
||||
"direction_note": "บขส.อ่างทอง → โพธิ์ทอง → แสวงหา → วัดสีบัวทอง"
|
||||
},
|
||||
{
|
||||
"dir_id": "dir-1",
|
||||
"dir_label": "จากวัดสีบัวทอง",
|
||||
"direction_id": "dir-1",
|
||||
"direction_label": "จากวัดสีบัวทอง",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
@@ -32,9 +35,10 @@
|
||||
"06:30",
|
||||
"14:30"
|
||||
],
|
||||
"dir_note": "จากวัดสีบัวทอง"
|
||||
"direction_note": "วัดสีบัวทอง → แสวงหา → โพธิ์ทอง → บขส.อ่างทอง"
|
||||
}
|
||||
]
|
||||
],
|
||||
"direction_note": "วัดสีบัวทอง → แสวงหา → โพธิ์ทอง → บขส.อ่างทอง"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "15",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
1,
|
||||
@@ -11,8 +13,8 @@
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "from-1",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-1",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 1,
|
||||
@@ -26,8 +28,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "all",
|
||||
"dir_label": null,
|
||||
"direction_id": "all",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 2,
|
||||
@@ -60,8 +62,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "new-3",
|
||||
"dir_label": null,
|
||||
"direction_id": "new-3",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 5,
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "2194",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
4,
|
||||
8
|
||||
8,
|
||||
4
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "dir-1",
|
||||
"dir_label": "จากวัดหัวเวียง",
|
||||
"direction_id": "dir-1",
|
||||
"direction_label": "ออกจากวัดหัวเวียง",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
@@ -18,13 +20,13 @@
|
||||
"06:00",
|
||||
"07:00"
|
||||
],
|
||||
"dir_note": "จากวัดหัวเวียง"
|
||||
"direction_note": "ออกจากวัดหัวเวียง"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "from-4",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-4",
|
||||
"direction_label": "ออกจากตลาดเจ้าพรหม",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 4,
|
||||
@@ -32,7 +34,8 @@
|
||||
"16:00",
|
||||
"17:00",
|
||||
"18:00"
|
||||
]
|
||||
],
|
||||
"direction_note": "ออกจากตลาดเจ้าพรหม"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "2231",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
1,
|
||||
8
|
||||
8,
|
||||
1
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "from-1",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-1",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 1,
|
||||
@@ -20,15 +22,15 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "dir-1",
|
||||
"dir_label": "จากวัดมหานาม",
|
||||
"direction_id": "dir-1",
|
||||
"direction_label": "จากวัดมหานาม",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
"times": [
|
||||
"08:00"
|
||||
],
|
||||
"dir_note": "จากวัดมหานาม"
|
||||
"direction_note": "จากวัดมหานาม"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "324",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
1,
|
||||
8
|
||||
8,
|
||||
1
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "from-1",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-1",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 1,
|
||||
@@ -20,15 +22,15 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "dir-1",
|
||||
"dir_label": "จากวัดไชโยวรวิหาร",
|
||||
"direction_id": "dir-1",
|
||||
"direction_label": "จากวัดไชโยวรวิหาร",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
"times": [
|
||||
"08:00"
|
||||
],
|
||||
"dir_note": "จากวัดไชโยวรวิหาร"
|
||||
"direction_note": "จากวัดไชโยวรวิหาร"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "464",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
1,
|
||||
9,
|
||||
1,
|
||||
10
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "all",
|
||||
"dir_label": null,
|
||||
"direction_id": "all",
|
||||
"direction_label": "จากบขส.สุพรรณบุรี / บขส.สระบุรี",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 9,
|
||||
@@ -69,71 +71,35 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "dir-1",
|
||||
"dir_label": "ไปสุพรรณบุรี",
|
||||
"direction_id": "dir-1",
|
||||
"direction_label": "ออกจากอ่างทอง",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 1,
|
||||
"times": [
|
||||
"06:30",
|
||||
"07:10",
|
||||
"07:50",
|
||||
"08:40",
|
||||
"09:30",
|
||||
"10:10",
|
||||
"10:50",
|
||||
"11:30",
|
||||
"12:10",
|
||||
"12:50",
|
||||
"13:30",
|
||||
"14:10",
|
||||
"14:50",
|
||||
"15:30",
|
||||
"16:10",
|
||||
"16:50",
|
||||
"17:30",
|
||||
"18:10",
|
||||
"18:50",
|
||||
"19:30"
|
||||
],
|
||||
"dir_note": "ไปสุพรรณบุรี"
|
||||
"times": [],
|
||||
"direction_note": "ไปสุพรรณบุรี",
|
||||
"derive": {
|
||||
"from_station_id": 10,
|
||||
"offset_min": 90,
|
||||
"note": "ถึงอ่างทองหลังรถออกจาก บขส.สระบุรี 90 นาที"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "dir-2",
|
||||
"dir_label": "ไปสระบุรี",
|
||||
"direction_id": "dir-2",
|
||||
"direction_label": "ออกจากอ่างทอง",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 1,
|
||||
"times": [
|
||||
"05:40",
|
||||
"06:10",
|
||||
"06:40",
|
||||
"07:10",
|
||||
"07:40",
|
||||
"08:10",
|
||||
"08:40",
|
||||
"09:15",
|
||||
"09:50",
|
||||
"10:25",
|
||||
"11:00",
|
||||
"11:35",
|
||||
"12:10",
|
||||
"12:45",
|
||||
"13:20",
|
||||
"13:55",
|
||||
"14:30",
|
||||
"15:05",
|
||||
"15:40",
|
||||
"16:15",
|
||||
"16:50",
|
||||
"17:25",
|
||||
"18:00",
|
||||
"18:40"
|
||||
],
|
||||
"dir_note": "ไปสระบุรี",
|
||||
"note": null
|
||||
"times": [],
|
||||
"direction_note": "ไปสระบุรี",
|
||||
"note": null,
|
||||
"derive": {
|
||||
"from_station_id": 9,
|
||||
"offset_min": 60,
|
||||
"note": "ถึงอ่างทองหลังรถออกจาก บขส.สุพรรณบุรี 60 นาที"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "641",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
1,
|
||||
7,
|
||||
8
|
||||
8,
|
||||
7
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "from-1",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-1",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 1,
|
||||
@@ -24,13 +26,14 @@
|
||||
"13:30",
|
||||
"14:30",
|
||||
"16:30"
|
||||
]
|
||||
],
|
||||
"note": "10:00 และ 13:30 ไม่ได้มีทุกวัน"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "all",
|
||||
"dir_label": null,
|
||||
"direction_id": "all",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 7,
|
||||
@@ -48,6 +51,38 @@
|
||||
"note": "10:00 และ 13:30 ไม่ได้มีทุกวัน"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"direction_id": "new-3",
|
||||
"direction_label": "7-11บ้านแพรกไปลพบุรี",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
"derive": {
|
||||
"from_station_id": 1,
|
||||
"offset_min": 25,
|
||||
"note": null
|
||||
},
|
||||
"times": []
|
||||
}
|
||||
],
|
||||
"autoTimes": true
|
||||
},
|
||||
{
|
||||
"direction_id": "new-3",
|
||||
"direction_label": "7-11บ้านแพรกไปอ่างทอง",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
"derive": {
|
||||
"from_station_id": 7,
|
||||
"offset_min": 25,
|
||||
"note": "อ่างทอง"
|
||||
},
|
||||
"times": []
|
||||
}
|
||||
],
|
||||
"autoTimes": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "8",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
13,
|
||||
@@ -11,8 +13,8 @@
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "all",
|
||||
"dir_label": null,
|
||||
"direction_id": "all",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 13,
|
||||
@@ -25,8 +27,8 @@
|
||||
"speedKmh": 60
|
||||
},
|
||||
{
|
||||
"dir_id": "dir-1",
|
||||
"dir_label": null,
|
||||
"direction_id": "dir-1",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 6,
|
||||
@@ -34,14 +36,14 @@
|
||||
"10:00",
|
||||
"13:00"
|
||||
],
|
||||
"dir_note": null,
|
||||
"direction_note": null,
|
||||
"note": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "rungsit",
|
||||
"dir_label": "ตลาดแสวงหา",
|
||||
"direction_id": "rungsit",
|
||||
"direction_label": "ตลาดแสวงหา",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
@@ -55,8 +57,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "rungsit",
|
||||
"dir_label": "ตลาดสดเทศบาลตำบลโพธิ์ทอง",
|
||||
"direction_id": "rungsit",
|
||||
"direction_label": "ตลาดสดเทศบาลตำบลโพธิ์ทอง",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
@@ -70,8 +72,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "rungsit",
|
||||
"dir_label": null,
|
||||
"direction_id": "rungsit",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 5,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "902",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
1,
|
||||
@@ -9,8 +11,8 @@
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "from-1",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-1",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 1,
|
||||
@@ -48,8 +50,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "rungsit",
|
||||
"dir_label": null,
|
||||
"direction_id": "rungsit",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 15,
|
||||
@@ -63,8 +65,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "all",
|
||||
"dir_label": null,
|
||||
"direction_id": "all",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 6,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "951",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
9,
|
||||
@@ -10,8 +12,8 @@
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "from-9",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-9",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 9,
|
||||
@@ -64,20 +66,20 @@
|
||||
{
|
||||
"station_id": 8,
|
||||
"times": [],
|
||||
"dir_note": "ตลาดวิเศษชัยชาญ",
|
||||
"direction_note": "ตลาดวิเศษชัยชาญ",
|
||||
"note": "ตลาดวิเศษชัยชาญ"
|
||||
},
|
||||
{
|
||||
"station_id": 8,
|
||||
"times": [],
|
||||
"dir_note": "ตลาดอ่างทอง",
|
||||
"direction_note": "ตลาดอ่างทอง",
|
||||
"note": "ตลาดอ่างทอง"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "new-2",
|
||||
"dir_label": null,
|
||||
"direction_id": "new-2",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 6,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "952",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
11,
|
||||
@@ -8,8 +10,8 @@
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "dir-1",
|
||||
"dir_label": "จากตลาดวิเศษ",
|
||||
"direction_id": "dir-1",
|
||||
"direction_label": "จากตลาดวิเศษ",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 11,
|
||||
@@ -18,14 +20,14 @@
|
||||
"10:00",
|
||||
"15:00"
|
||||
],
|
||||
"dir_note": "จากตลาดวิเศษ",
|
||||
"direction_note": "จากตลาดวิเศษ",
|
||||
"note": "10:00 มีเฉพาะวันหยุด"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "all",
|
||||
"dir_label": null,
|
||||
"direction_id": "all",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 12,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "954",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
8,
|
||||
@@ -9,8 +11,8 @@
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "dir-1",
|
||||
"dir_label": "จากตลาดท่าช้าง",
|
||||
"direction_id": "to-bkk",
|
||||
"direction_label": "ไปกรุงเทพ (จตุจักร)",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 8,
|
||||
@@ -20,8 +22,18 @@
|
||||
"10:20",
|
||||
"12:40"
|
||||
],
|
||||
"dir_note": "จากตลาดท่าช้าง"
|
||||
"direction_note": "ตลาดท่าช้าง"
|
||||
},
|
||||
{
|
||||
"station_id": 6,
|
||||
"times": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"direction_id": "to-thachang",
|
||||
"direction_label": "ไปท่าช้าง",
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 6,
|
||||
"times": [
|
||||
@@ -29,37 +41,19 @@
|
||||
"09:00",
|
||||
"14:00",
|
||||
"16:00"
|
||||
],
|
||||
"dir_note": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "rungsit",
|
||||
"dir_label": null,
|
||||
"stops": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"station_id": 5,
|
||||
"times": [],
|
||||
"derive": {
|
||||
"from_station_id": 6,
|
||||
"offset_min": 30,
|
||||
"note": ""
|
||||
},
|
||||
"times": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"dir_id": "rungsit",
|
||||
"dir_label": "ตลาดสามโก้",
|
||||
"stops": [
|
||||
"note": "ผ่านรังสิตหลังรถออกจากจตุจักร 30 นาที"
|
||||
}
|
||||
},
|
||||
{
|
||||
"station_id": 8,
|
||||
"derive": {
|
||||
"from_station_id": 8,
|
||||
"offset_min": 45,
|
||||
"note": "จากตลาดสามโก้"
|
||||
},
|
||||
"times": []
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
{
|
||||
"schema": 2,
|
||||
"route_id": "999",
|
||||
|
||||
"updated": "2026-10-04",
|
||||
"generated_from": "schedules.json",
|
||||
"station_order": [
|
||||
14
|
||||
],
|
||||
"directions": [
|
||||
{
|
||||
"dir_id": "from-14",
|
||||
"dir_label": null,
|
||||
"direction_id": "from-14",
|
||||
"direction_label": null,
|
||||
"stops": [
|
||||
{
|
||||
"station_id": 14,
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""bump-version.py — เพิ่มเวอร์ชันแอป (cache busting) ให้ตรงกันทุกที่ในคำสั่งเดียว
|
||||
|
||||
ทำอะไร:
|
||||
1) ui/sw.js const VERSION = "..." ← ตัวจริง (cache-first ใช้ค่านี้)
|
||||
2) ui/index.html <meta name="app-version" ...> ← ให้ ImgURL.of() ใช้
|
||||
3) ui/index.html โลโก้/ไอคอน ?v=... (static) ← รูปที่ฝังใน HTML
|
||||
|
||||
วิธีใช้:
|
||||
python resource/tools/bump-version.py # +1 รอบ (เช่น 2026.09.27.23 → .24)
|
||||
python resource/tools/bump-version.py 2026.10.01 # ตั้งค่าเอง (จะได้ 2026.10.01.1)
|
||||
python resource/tools/bump-version.py --show # แค่แสดงเวอร์ชันปัจจุบัน (ไม่เขียน)
|
||||
python resource/tools/bump-version.py --sync # ไม่เพิ่มเลข แค่ทำให้ทุกที่ตรงกับ sw.js
|
||||
|
||||
หลังอัปรูป: รันคำสั่งนี้ แล้วให้ผู้ใช้กด Ctrl+Shift+R ครั้งเดียว = เห็นรูปใหม่ทั้งหมด
|
||||
"""
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
UI = ROOT / "ui"
|
||||
SW = UI / "sw.js"
|
||||
INDEX = UI / "index.html"
|
||||
|
||||
VER_RE = re.compile(r'const VERSION = "([^"]+)";')
|
||||
|
||||
|
||||
def read_version():
|
||||
m = VER_RE.search(SW.read_text(encoding="utf-8"))
|
||||
if not m:
|
||||
sys.exit("ไม่พบ const VERSION ใน ui/sw.js")
|
||||
return m.group(1)
|
||||
|
||||
|
||||
def next_version(cur, base=None):
|
||||
"""cur = '2026.09.27.23' → '2026.09.27.24' · base='2026.10.01' → '2026.10.01.1'"""
|
||||
if base:
|
||||
m = re.match(r"^(\d{4}\.\d{2}\.\d{2})(?:\.(\d+))?$", base.strip())
|
||||
if not m:
|
||||
sys.exit(f"รูปแบบวันที่ไม่ถูกต้อง: {base} (ต้องเป็น YYYY.MM.DD)")
|
||||
n = int(m.group(2) or 0) + 1
|
||||
return f"{m.group(1)}.{n}"
|
||||
parts = cur.split(".")
|
||||
if len(parts) < 4 or not parts[-1].isdigit():
|
||||
return cur + ".1"
|
||||
return ".".join(parts[:-1] + [str(int(parts[-1]) + 1)])
|
||||
|
||||
|
||||
def apply(ver, dry=False):
|
||||
changed = []
|
||||
|
||||
# 1) sw.js
|
||||
sw = SW.read_text(encoding="utf-8")
|
||||
sw2 = VER_RE.sub(f'const VERSION = "{ver}";', sw, count=1)
|
||||
if sw2 != sw:
|
||||
if not dry:
|
||||
SW.write_text(sw2, encoding="utf-8")
|
||||
changed.append("ui/sw.js")
|
||||
|
||||
# 2) index.html — meta + โลโก้ static (?v=)
|
||||
idx = INDEX.read_text(encoding="utf-8")
|
||||
idx2 = re.sub(r'(<meta name="app-version" content=")[^"]*(">)', rf"\g<1>{ver}\g<2>", idx)
|
||||
idx2 = re.sub(r'(\.image/icons/[^"?]+\.(?:png|jpg|jpeg|webp|svg))\?v=[^"&]*', rf"\g<1>?v={ver}", idx2)
|
||||
if idx2 != idx:
|
||||
if not dry:
|
||||
INDEX.write_text(idx2, encoding="utf-8")
|
||||
changed.append("ui/index.html")
|
||||
|
||||
return changed
|
||||
|
||||
|
||||
def report(ver, changed, dry=False):
|
||||
n_img = len(re.findall(r"\.image/[^\"]+\?v=", INDEX.read_text(encoding="utf-8")))
|
||||
print(f"เวอร์ชัน: {ver}" + (" [dry-run]" if dry else ""))
|
||||
print(f" แก้ไฟล์: {', '.join(changed) if changed else 'ไม่มี (ตรงกันอยู่แล้ว)'}")
|
||||
print(f" รูป static ที่เติม ?v= ใน index.html: {n_img} จุด")
|
||||
print(f" รูป dynamic (routes/qrcode/stations/stops): เติมอัตโนมัติผ่าน ImgURL.of()")
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("base", nargs="?", help="วันที่ฐาน YYYY.MM.DD (ไม่ใส่ = เพิ่มเลขรอบเดิม)")
|
||||
ap.add_argument("--show", action="store_true", help="แสดงเวอร์ชันปัจจุบัน")
|
||||
ap.add_argument("--sync", action="store_true", help="ทำให้ทุกที่ตรงกับ sw.js (ไม่เพิ่มเลข)")
|
||||
ap.add_argument("--check", action="store_true", help="ตรวจว่าทุกที่ตรงกันไหม (exit 1 ถ้าไม่ตรง)")
|
||||
args = ap.parse_args()
|
||||
|
||||
cur = read_version()
|
||||
|
||||
if args.show:
|
||||
print(f"เวอร์ชันปัจจุบัน: {cur}")
|
||||
return 0
|
||||
|
||||
if args.check:
|
||||
idx = INDEX.read_text(encoding="utf-8")
|
||||
m = re.search(r'<meta name="app-version" content="([^"]*)"', idx)
|
||||
meta = m.group(1) if m else None
|
||||
logos = set(re.findall(r"\.image/icons/[^\"]+?\?v=([^\"&]+)", idx))
|
||||
ok = (meta == cur) and (logos == {cur} or not logos)
|
||||
print(f"sw.js VERSION = {cur}")
|
||||
print(f"meta app-version= {meta} {'✓' if meta == cur else '✗ ไม่ตรง'}")
|
||||
print(f"โลโก้ ?v= = {sorted(logos) or '-'} {'✓' if (logos == {cur} or not logos) else '✗ ไม่ตรง'}")
|
||||
return 0 if ok else 1
|
||||
|
||||
ver = cur if args.sync else next_version(cur, args.base)
|
||||
changed = apply(ver, dry=False)
|
||||
report(ver, changed)
|
||||
print("\nขั้นตอนถัดไป: ให้ผู้ใช้กด Ctrl+Shift+R ครั้งเดียว (รูปทั้งหมดจะโหลดใหม่)")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""check-i18n.py — ตรวจความครบถ้วนของคำแปล (ui/locales/<lang>.json)
|
||||
|
||||
ตรวจ 5 เรื่อง:
|
||||
1. คีย์ที่ขาดในภาษาใดภาษาหนึ่ง → ERROR (โหมดนั้นจะถอยไปใช้ภาษาตั้งต้น = คำไทยโผล่ในหน้า EN)
|
||||
2. คีย์ซ้ำภายในไฟล์ภาษาเดียวกัน → ERROR (JSON เก็บตัวหลังเงียบ ๆ — เคยทำให้ค่าอังกฤษทับค่าไทย)
|
||||
3. ไฟล์ภาษาไม่ตรงกับ SUPPORTED ใน i18n.js → ERROR
|
||||
4. ค่าที่ว่างเปล่า → WARN (อาจตั้งใจ เช่น home.provincePrefix ของ EN)
|
||||
5. คีย์ที่ไม่พบที่ใช้ → WARN (อาจใช้แบบไดนามิกก็ได้)
|
||||
|
||||
ใช้:
|
||||
python resource/tools/check-i18n.py
|
||||
python resource/tools/check-i18n.py --quiet (แสดงเฉพาะที่มีปัญหา)
|
||||
"""
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
R = Path(__file__).resolve().parents[2]
|
||||
LOCALES = R / "ui/locales"
|
||||
BASE = "th" # ภาษาตั้งต้น — ใช้เทียบว่าคีย์ครบไหม
|
||||
quiet = "--quiet" in sys.argv
|
||||
|
||||
errors, warns = [], []
|
||||
|
||||
# ── 1) อ่านไฟล์ภาษาทั้งหมด (จับคีย์ซ้ำด้วย object_pairs_hook) ──
|
||||
files = sorted(LOCALES.glob("*.json"))
|
||||
if not files:
|
||||
print(f"!! ไม่พบไฟล์ภาษาใน {LOCALES.relative_to(R)}")
|
||||
sys.exit(1)
|
||||
|
||||
dicts, dups = {}, {}
|
||||
for p in files:
|
||||
lg = p.stem
|
||||
found = []
|
||||
|
||||
def hook(pairs, _found=found):
|
||||
seen = {}
|
||||
for k, v in pairs:
|
||||
if k in seen:
|
||||
_found.append(k)
|
||||
seen[k] = v
|
||||
return seen
|
||||
|
||||
try:
|
||||
dicts[lg] = json.loads(p.read_text(encoding="utf-8"), object_pairs_hook=hook)
|
||||
except Exception as e:
|
||||
errors.append((f"อ่านไฟล์ {p.name} ไม่ได้", [str(e)[:70]]))
|
||||
continue
|
||||
if found:
|
||||
dups[lg] = found
|
||||
|
||||
langs = sorted(dicts)
|
||||
if BASE not in dicts:
|
||||
errors.append((f"ไม่พบภาษาตั้งต้น '{BASE}'", [str(l) for l in langs]))
|
||||
|
||||
# ── 2) ไฟล์ภาษาต้องตรงกับ SUPPORTED ใน i18n.js ──
|
||||
src = (R / "ui/i18n.js").read_text(encoding="utf-8")
|
||||
m = re.search(r"var SUPPORTED\s*=\s*\[([^\]]*)\]", src)
|
||||
supported = re.findall(r"'([\w-]+)'", m.group(1)) if m else []
|
||||
if supported and sorted(supported) != langs:
|
||||
errors.append(("SUPPORTED ใน i18n.js ไม่ตรงกับไฟล์ภาษา",
|
||||
[f"js={supported}", f"files={langs}"]))
|
||||
|
||||
# ── 3) คีย์ขาด / คีย์ซ้ำ ──
|
||||
base_keys = list(dicts.get(BASE, {}))
|
||||
for lg in langs:
|
||||
if lg == BASE:
|
||||
continue
|
||||
missing = [k for k in base_keys if k not in dicts[lg]]
|
||||
if missing:
|
||||
errors.append((f"คีย์ขาดใน '{lg}' ({len(missing)})", missing))
|
||||
extra = [k for k in dicts[lg] if k not in dicts[BASE]]
|
||||
if extra:
|
||||
warns.append((f"คีย์ที่มีใน '{lg}' แต่ไม่มีใน '{BASE}' ({len(extra)})", extra))
|
||||
for lg in sorted(dups):
|
||||
errors.append((f"คีย์ซ้ำในไฟล์ '{lg}.json' ({len(set(dups[lg]))})", sorted(set(dups[lg]))))
|
||||
|
||||
# ── 4) ค่าที่ว่างเปล่า ──
|
||||
empty = [f"{lg}:{k}" for lg in langs for k, v in dicts[lg].items() if not str(v).strip()]
|
||||
if empty:
|
||||
warns.append((f"ค่าที่ว่างเปล่า ({len(empty)}) — อาจตั้งใจ", empty))
|
||||
|
||||
# ── 5) คีย์ที่ไม่พบที่ใช้ ──
|
||||
# ตรงตัว: t('key') · data-i18n="key" · data-i18n-attr="attr:key"
|
||||
# ไดนามิก: literal ที่ลงท้ายด้วย '.' เป็นคำนำหน้าคีย์ (เช่น 'check.day' + type)
|
||||
used, all_lits = set(), set()
|
||||
for f in list((R / "ui").rglob("*.js")) + list((R / "ui").rglob("*.html")):
|
||||
if "vendor" in str(f) or f.name == "i18n.js":
|
||||
continue
|
||||
txt = f.read_text(encoding="utf-8", errors="ignore")
|
||||
used |= set(re.findall(r"""tr?\('([\w.]+)'""", txt))
|
||||
used |= set(re.findall(r'data-i18n(?:-n)?="([\w.]+)"', txt))
|
||||
used |= set(re.findall(r'data-i18n-attr="[^":]+:([\w.]+)"', txt))
|
||||
all_lits |= set(re.findall(r"'([\w.]{2,80})'", txt))
|
||||
prefixes = {x for x in all_lits if x.endswith(".")}
|
||||
unused = sorted(k for k in base_keys
|
||||
if k not in used and k not in all_lits
|
||||
and not any(k.startswith(p) for p in prefixes))
|
||||
if unused:
|
||||
warns.append((f"ไม่พบที่ใช้ ({len(unused)}) — อาจใช้แบบไดนามิกก็ได้", unused))
|
||||
|
||||
# ── รายงาน ──
|
||||
if not quiet:
|
||||
print("i18n: ui/locales/ · " + " · ".join(f"{lg}={len(dicts[lg])}" for lg in langs) +
|
||||
f" · ภาษาตั้งต้น={BASE} · ไฟล์ที่ใช้จริง {LOCALES.relative_to(R)}")
|
||||
for title, items in errors:
|
||||
print(f"[ERROR] {title}: {', '.join(str(i) for i in items[:12])}" + (" …" if len(items) > 12 else ""))
|
||||
for title, items in warns:
|
||||
print(f"[WARN ] {title}: {', '.join(str(i) for i in items[:12])}" + (" …" if len(items) > 12 else ""))
|
||||
|
||||
if errors:
|
||||
print(f"\nผลลัพธ์: ไม่ผ่าน — {len(errors)} เรื่องต้องแก้")
|
||||
sys.exit(1)
|
||||
print(f"\nผลลัพธ์: ผ่าน — ทุกคีย์มีครบทั้ง {len(langs)} ภาษา ไม่มีคีย์ซ้ำ" +
|
||||
(f" (มี {len(warns)} คำเตือน)" if warns else ""))
|
||||
sys.exit(0)
|
||||
@@ -72,7 +72,7 @@ def all_times(sub, station_id):
|
||||
for d in sub.get("directions", []):
|
||||
for s in d.get("stops", []):
|
||||
if int(s["station_id"]) == int(station_id) and (s.get("times") or []):
|
||||
return s["times"], d.get("dir_id")
|
||||
return s["times"], d.get("direction_id")
|
||||
return [], None
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ def main():
|
||||
for st in d.get("stops", []):
|
||||
t = tuple(st.get("times") or [])
|
||||
if t:
|
||||
sig.setdefault(t, []).append((d.get("dir_id"), st["station_id"], st.get("derive")))
|
||||
sig.setdefault(t, []).append((d.get("direction_id"), st["station_id"], st.get("derive")))
|
||||
for times, who in sig.items():
|
||||
if len(who) < 2:
|
||||
continue
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
แหล่งข้อมูล 2 ทาง (ค่าเริ่มต้น = shapefile เพราะวิธีทำงานจริงคือแก้ใน QGIS แล้วกด Save):
|
||||
python resource/tools/qgis-to-web.py # อ่าน <รหัสสาย>.shp ตามตาราง SHP_MAP (แนะนำ)
|
||||
python resource/tools/qgis-to-web.py --from geojson # อ่าน GeoJSON-2/*.geojson (เส้นทางเดิม)
|
||||
python resource/tools/qgis-to-web.py --from gpkg # อ่าน angthongtoanytrain/*.gpkg (เส้นทางที่เสนอ/ความฝัน)
|
||||
|
||||
ธงอื่น:
|
||||
--check ตรวจเทียบกับไฟล์ปัจจุบัน ไม่เขียนไฟล์
|
||||
@@ -29,7 +30,20 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
QDIR = ROOT / "resource" / "data" / "QGIS Project"
|
||||
SRC_GEOJSON = QDIR / "GeoJSON-2"
|
||||
SRC_GPKG = QDIR / "angthongtoanytrain" # เส้นทางที่เสนอ (ยังไม่มีจริง) — 1 ไฟล์ = 1 เส้นทาง
|
||||
DST = ROOT / "resource" / "data" / "geojson-web"
|
||||
|
||||
# ── ตารางจับคู่ "ชื่อไฟล์ .gpkg → route_id" (เส้นทางที่เสนอ) ──────────────────
|
||||
# route_id ต้องไม่ชนกับสายจริง (902/15/951/952/954/8/101/464/641/2194/324/1011/2231/999)
|
||||
# ชื่อไฟล์ .gpkg เป็นภาษาไทยได้ — คีย์คือชื่อ stem (ไม่รวม .gpkg)
|
||||
GPKG_MAP = {
|
||||
"อ่างทอง-บ้านภาชี(สายสีแดงเข้ม)": "dream-banchang",
|
||||
"อ่างทอง-รถไฟฟ้าชานเมืองอยุธยา(สายสีแดงเข้ม)": "dream-ayutthaya-redline",
|
||||
"อ่างทอง-สถานีรถไฟความเร็วสูงอยุธยา": "dream-ayutthaya-hsr",
|
||||
"อ่างทอง-เมืองทองธานี": "dream-muangthong",
|
||||
"อ่างทอง-แยกปากเกร็ด": "dream-pakkret",
|
||||
"อ่างทอง-วัชรพล": "dream-Watcharapol",
|
||||
}
|
||||
BBOX = (97.0, 103.0, 12.0, 17.5) # lng_min, lng_max, lat_min, lat_max
|
||||
|
||||
# ── ตารางจับคู่ "รหัสสาย → ไฟล์ .shp ในโปรเจกต์ QGIS" ─────────────────────────
|
||||
@@ -112,6 +126,85 @@ def looks_like_utm(lines):
|
||||
return max(abs(min(xs)), abs(max(xs))) > 1000
|
||||
|
||||
|
||||
# ── อ่าน GeoPackage (.gpkg = SQLite) — ไม่ต้องพึ่ง GDAL/geopandas ──
|
||||
def read_gpkg(path):
|
||||
"""คืน (lines, srs_id, ชื่อชั้น) — รองรับ LineString/MultiLineString · พิกัด (lng, lat)
|
||||
GPKG geometry blob = 'GP' + ver(1) + flags(1) + srs_id(4) + envelope(ตาม flags) + WKB"""
|
||||
import sqlite3
|
||||
con = sqlite3.connect(f"file:{path}?mode=ro", uri=True)
|
||||
try:
|
||||
cur = con.cursor()
|
||||
row = cur.execute(
|
||||
"SELECT table_name FROM gpkg_contents WHERE data_type='features' LIMIT 1").fetchone()
|
||||
if not row:
|
||||
return None, None, None
|
||||
table = row[0]
|
||||
srs = cur.execute("SELECT srs_id FROM gpkg_geometry_columns WHERE table_name=?",
|
||||
(table,)).fetchone()
|
||||
blob = cur.execute(f'SELECT geometry FROM "{table}" LIMIT 1').fetchone()[0]
|
||||
finally:
|
||||
con.close()
|
||||
return _parse_gpkg_blob(blob), (srs[0] if srs else None), table
|
||||
|
||||
|
||||
def _parse_gpkg_blob(blob):
|
||||
"""ถอด WKB จาก GPKG blob → list ของเส้น; แต่ละเส้น = list ของ [lng, lat]"""
|
||||
if not blob or blob[:2] != b"GP":
|
||||
return []
|
||||
flags = blob[3]
|
||||
env = {0: 0, 1: 4, 2: 6, 3: 6, 4: 8}.get((flags >> 1) & 0x07, 0)
|
||||
o = 8 + env * 8
|
||||
order = blob[o]
|
||||
E = "<" if order == 1 else ">"
|
||||
gtype = struct.unpack(E + "I", blob[o + 1:o + 5])[0]
|
||||
o += 5
|
||||
lines = []
|
||||
if gtype == 2: # LineString
|
||||
n = struct.unpack(E + "I", blob[o:o + 4])[0]
|
||||
o += 4
|
||||
lines.append([list(struct.unpack(E + "dd", blob[o + 16 * i:o + 16 * i + 16]))
|
||||
for i in range(n)])
|
||||
elif gtype == 5: # MultiLineString
|
||||
n = struct.unpack(E + "I", blob[o:o + 4])[0]
|
||||
o += 4
|
||||
for _ in range(n):
|
||||
E2 = "<" if blob[o] == 1 else ">"
|
||||
m = struct.unpack(E2 + "I", blob[o + 5:o + 9])[0]
|
||||
o += 9
|
||||
lines.append([list(struct.unpack(E2 + "dd", blob[o + 16 * i:o + 16 * i + 16]))
|
||||
for i in range(m)])
|
||||
o += 16 * m
|
||||
return [l for l in lines if len(l) >= 2]
|
||||
|
||||
|
||||
def from_gpkg(route_id):
|
||||
"""คืน (features, รายงาน) จาก angthongtoanytrain/<ชื่อ>.gpkg ตาม GPKG_MAP"""
|
||||
stem = next((k for k, v in GPKG_MAP.items() if v == route_id), None)
|
||||
if stem is None:
|
||||
return None, ["ไม่มีในตาราง GPKG_MAP — ข้าม"]
|
||||
path = SRC_GPKG / f"{stem}.gpkg"
|
||||
if not path.exists():
|
||||
return None, [f"ไม่พบไฟล์ {path.name} (ชื่อเปลี่ยน? แก้ GPKG_MAP)"]
|
||||
lines, srs, table = read_gpkg(path)
|
||||
if not lines:
|
||||
return None, ["ไม่มีเส้นในไฟล์ (หรือชนิด geometry ไม่รองรับ)"]
|
||||
if srs not in (None, 4326):
|
||||
return None, [f"SRS = {srs} (ไม่ใช่ EPSG:4326) — บันทึกใหม่ใน QGIS"]
|
||||
if looks_like_utm(lines):
|
||||
return None, ["พิกัดเป็น UTM (ไม่ใช่ WGS84) — บันทึกใหม่โดยตั้ง CRS = EPSG:4326"]
|
||||
|
||||
kept, dropped = clean_lines(lines)
|
||||
if not kept:
|
||||
return None, ["หลังกรองแล้วไม่มีเส้นเหลือ — ข้าม"]
|
||||
geom = ("MultiLineString" if len(kept) > 1 else "LineString")
|
||||
feat = {"type": "Feature", "properties": {"route_id": route_id},
|
||||
"geometry": {"type": geom, "coordinates": (kept if len(kept) > 1 else kept[0])}}
|
||||
notes = [f"ชั้น '{table}' · srs={srs}"]
|
||||
if dropped:
|
||||
notes.append(f"ตัด {dropped} ช่วงที่สั้น/หลุดกรอบ")
|
||||
return [feat], notes
|
||||
|
||||
|
||||
def from_shp(route_id):
|
||||
"""คืน (features, รายงาน) จาก shapefile ตาม SHP_MAP"""
|
||||
stem = SHP_MAP.get(route_id)
|
||||
@@ -193,12 +286,14 @@ def targets(mode):
|
||||
"""รายการ route_id ที่จะสร้าง (จากตาราง SHP_MAP หรือไฟล์ GeoJSON-2)"""
|
||||
if mode == "shp":
|
||||
return sorted(SHP_MAP)
|
||||
if mode == "gpkg":
|
||||
return sorted(GPKG_MAP.values())
|
||||
return sorted(p.stem for p in SRC_GEOJSON.glob("*.geojson"))
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="QGIS (shapefile/GeoJSON) → resource/data/geojson-web/")
|
||||
ap.add_argument("--from", dest="src", choices=["shp", "geojson"], default="shp",
|
||||
ap.add_argument("--from", dest="src", choices=["shp", "geojson", "gpkg"], default="shp",
|
||||
help="แหล่งข้อมูล (ค่าเริ่มต้น shp)")
|
||||
ap.add_argument("--check", action="store_true", help="ตรวจอย่างเดียว ไม่เขียนไฟล์")
|
||||
ap.add_argument("--list", action="store_true", help="แสดงตารางจับคู่ + สถานะไฟล์")
|
||||
@@ -216,7 +311,9 @@ def main():
|
||||
return
|
||||
|
||||
from_shp_source = args.src == "shp"
|
||||
label = "shapefile (QGIS Project/*.shp)" if from_shp_source else "GeoJSON-2/*.geojson"
|
||||
label = {"shp": "shapefile (QGIS Project/*.shp)",
|
||||
"geojson": "GeoJSON-2/*.geojson",
|
||||
"gpkg": "angthongtoanytrain/*.gpkg (เส้นทางที่เสนอ)"}[args.src]
|
||||
print(f"ต้นทาง : {label} ({len(ids)} สาย)")
|
||||
print(f"ปลายทาง: {DST.relative_to(ROOT)}" + (" [--check: ไม่เขียนไฟล์]\n" if args.check else "\n"))
|
||||
DST.mkdir(parents=True, exist_ok=True)
|
||||
@@ -224,8 +321,14 @@ def main():
|
||||
print(f"{'สาย':<8}{'จุด':<7}{'ไฟล์เดิม':<10}สถานะ")
|
||||
written = skipped = unchanged = 0
|
||||
for rid in ids:
|
||||
rid = re.sub(r"[^0-9A-Za-z]", "", rid) or rid
|
||||
feats, notes = (from_shp(rid) if from_shp_source else from_geojson(rid))
|
||||
if args.src != "gpkg": # dream-* มี "-" ต้องคงไว้
|
||||
rid = re.sub(r"[^0-9A-Za-z]", "", rid) or rid
|
||||
if args.src == "shp":
|
||||
feats, notes = from_shp(rid)
|
||||
elif args.src == "gpkg":
|
||||
feats, notes = from_gpkg(rid)
|
||||
else:
|
||||
feats, notes = from_geojson(rid)
|
||||
if feats is None:
|
||||
print(f"{rid:<8}{'-':<7}{'-':<10}ข้าม — {'; '.join(notes)}")
|
||||
skipped += 1
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
stops[] จุดจอดในทิศนั้น
|
||||
station_id
|
||||
times[] เวลาออกของจุดนี้
|
||||
dir_note ถ้อยคำทิศเดิมจากเจ้าของข้อมูล (เก็บไว้ ไม่แปลง)
|
||||
direction_note ถ้อยคำทิศเดิมจากเจ้าของข้อมูล (เก็บไว้ ไม่แปลง)
|
||||
note เงื่อนไขเวลาเดิมจากเจ้าของข้อมูล (เก็บไว้ ไม่แปลง)
|
||||
groups[] (อนาคต) ใช้เมื่อเวลาชุดเดียวกันแยกตามวัน เช่น 10:00 เฉพาะวันหยุด
|
||||
|
||||
กติกาการแยกทิศ (ยึดข้อมูลจริง):
|
||||
- "จุดแยกทิศ" = จุดที่มี record หลายทิศ = จุดที่รถแยกทาง (เช่น สาย 101 จุด 2 ป่าโมก มีทั้ง 'ไปอยุธยา'/'ไปออ่างทอง')
|
||||
- record ที่ไม่ระบุทิศ → ใช้ทิศของจุดแยกทิศที่อยู่ก่อนหน้าในลำดับ (จุดที่รถผ่านมาก่อน)
|
||||
- สายที่ไม่ระบุทิศเลย → ทิศเดียว dir_id = "all"
|
||||
- สายที่ไม่ระบุทิศเลย → ทิศเดียว direction_id = "all"
|
||||
|
||||
หมายเหตุ: เลิกใช้ schedule_id (ไม่มีโค้ดไหนอ้างถึง) — กุญแจคือ route_id + dir_id + station_id
|
||||
หมายเหตุ: เลิกใช้ schedule_id (ไม่มีโค้ดไหนอ้างถึง) — กุญแจคือ route_id + direction_id + station_id
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
@@ -95,8 +95,8 @@ def orient_order(rid, order, stations):
|
||||
def direction_of(rec, first_station):
|
||||
"""ทิศของ record ตามข้อมูลที่ระบุไว้จริง
|
||||
- มี direction_note → ทิศนั้น (แยกเป็น directions[] ของตัวเอง)
|
||||
- ไม่มี note + เป็นจุดต้นทาง (station_order[0]) → 'ออกจากต้นทาง' (dir_id = from-<station>)
|
||||
- ไม่มี note + จุดอื่น → ทิศทางเดียว (dir_id = "all")
|
||||
- ไม่มี note + เป็นจุดต้นทาง (station_order[0]) → 'ออกจากต้นทาง' (direction_id = from-<station>)
|
||||
- ไม่มี note + จุดอื่น → ทิศทางเดียว (direction_id = "all")
|
||||
ไม่พยายามเดาว่าจุดปลายทางอยู่ขาไหน (ข้อมูลเดิมขัดกันเอง — ต้องให้เจ้าของข้อมูลยืนยัน)
|
||||
"""
|
||||
label = rec.get("direction_note")
|
||||
@@ -146,17 +146,17 @@ def main():
|
||||
for rec in sorted(d["recs"], key=lambda r: r["station_id"]):
|
||||
entry = {"station_id": rec["station_id"], "times": rec.get("departure_times") or []}
|
||||
if rec.get("direction_note"):
|
||||
entry["dir_note"] = rec["direction_note"]
|
||||
entry["direction_note"] = rec["direction_note"]
|
||||
if rec.get("schedule_note"):
|
||||
entry["note"] = rec["schedule_note"]
|
||||
stops.append(entry)
|
||||
stops.sort(key=lambda x: (order.index(x["station_id"]) if x["station_id"] in order else 999))
|
||||
dir_id = "all" if kind == "all" else (("from-%s" % val) if kind == "start" else "dir-%d" % dir_seq)
|
||||
direction_id = "all" if kind == "all" else (("from-%s" % val) if kind == "start" else "dir-%d" % dir_seq)
|
||||
if kind == "label":
|
||||
dir_seq += 1
|
||||
dir_list.append({
|
||||
"dir_id": dir_id,
|
||||
"dir_label": d["label"],
|
||||
"direction_id": direction_id,
|
||||
"direction_label": d["label"],
|
||||
"stops": stops,
|
||||
})
|
||||
n_dup += sum(len(s["times"]) for s in stops)
|
||||
@@ -166,7 +166,7 @@ def main():
|
||||
counts = {s["station_id"]: len(s["times"]) for s in dl["stops"] if s["times"]}
|
||||
if len(set(counts.values())) > 1:
|
||||
warnings.append(
|
||||
f"สาย {rid} ทิศ '{dl['dir_label'] or 'ไม่แยกทิศ'}': จำนวนเที่ยวไม่เท่ากันข้ามจุด {counts} "
|
||||
f"สาย {rid} ทิศ '{dl['direction_label'] or 'ไม่แยกทิศ'}': จำนวนเที่ยวไม่เท่ากันข้ามจุด {counts} "
|
||||
f"— อาจยังแยกทิศไม่ครบ (ต้องให้เจ้าของข้อมูลยืนยัน)")
|
||||
|
||||
# เตือนจุดจอดที่ไม่มีเวลา (ไม่สร้างข้อมูลปลอม — UI จะขึ้น "ยังไม่มีข้อมูล")
|
||||
@@ -191,7 +191,7 @@ def main():
|
||||
for r in out_routes:
|
||||
for d in r["directions"]:
|
||||
cells = ", ".join(f"{s['station_id']}×{len(s['times'])}" for s in d["stops"])
|
||||
print(f"{r['route_id']:<7}{(d['dir_label'] or '(ไม่แยกทิศ)')[:22]:<24}{len(d['stops']):<5}"
|
||||
print(f"{r['route_id']:<7}{(d.get('direction_label') or '(ไม่แยกทิศ)')[:22]:<24}{len(d['stops']):<5}"
|
||||
f"{sum(len(s['times']) for s in d['stops']):<7}{cells}")
|
||||
|
||||
if warnings:
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""stamp-schedules.py — เติม/อัปเดตฟิลด์ "updated" (ISO YYYY-MM-DD) ใน scheduleslist/*.json
|
||||
|
||||
ที่มา: หน้า #/check แสดง "อัปเดตล่าสุด ... ที่แล้ว" โดยนับจากฟิลด์ "updated" ในไฟล์ตาราง
|
||||
เบราว์เซอร์อ่าน Last-Modified ของไฟล์ไม่ได้ (CORS) → ต้องบันทึกวันลงในไฟล์เอง
|
||||
|
||||
หลักการ:
|
||||
- วันที่ = mtime ของไฟล์จริง (เวลาแก้ไขล่าสุดบนดิสก์) แปลงเป็นเวลาไทย UTC+7
|
||||
- --check : ดูอย่างเดียว ไม่เขียนอะไร (dry run)
|
||||
- ไม่มี flag: เขียนไฟล์ที่ต้องแก้ (คง CRLF เดิมไว้)
|
||||
|
||||
ใช้:
|
||||
python resource/tools/stamp-schedules.py --check
|
||||
python resource/tools/stamp-schedules.py
|
||||
"""
|
||||
import datetime
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
R = Path(__file__).resolve().parents[2]
|
||||
D = R / "resource/data/scheduleslist"
|
||||
TZ_OFFSET = datetime.timedelta(hours=7) # เวลาไทย
|
||||
|
||||
dry = "--check" in sys.argv
|
||||
|
||||
|
||||
def today_th():
|
||||
return (datetime.datetime.now(datetime.timezone.utc) + TZ_OFFSET).date()
|
||||
|
||||
|
||||
def mtime_date(p):
|
||||
return (datetime.datetime.fromtimestamp(p.stat().st_mtime, datetime.timezone.utc) + TZ_OFFSET).date()
|
||||
|
||||
|
||||
def stamp_file(p):
|
||||
"""เติม/แก้ 'updated' หลัง route_id · คงรูปแบบ/CRLF เดิม · คืน (old, new, changed)"""
|
||||
raw = p.read_bytes()
|
||||
eol = b"\r\n" if b"\r\n" in raw[:4000] else b"\n"
|
||||
txt = raw.decode("utf-8")
|
||||
d = json.loads(txt)
|
||||
|
||||
if not isinstance(d, dict) or "route_id" not in d:
|
||||
return None, None, False
|
||||
|
||||
want = mtime_date(p).isoformat()
|
||||
have = str(d.get("updated") or "")
|
||||
if have == want:
|
||||
return have, want, False
|
||||
|
||||
if re.search(r'^\s*"updated"\s*:\s*"[^"]*",\s*$', txt, re.M):
|
||||
new = re.sub(r'(^\s*"updated"\s*:\s*")[^"]*(",\s*$)', lambda m: m.group(1) + want + m.group(2),
|
||||
txt, count=1, flags=re.M)
|
||||
else:
|
||||
# แทรกหลังบรรทัด route_id (คงการเยื้องเดิม)
|
||||
m = re.search(r'^(\s*)"route_id"\s*:\s*("[^"]*"\s*,?\s*)$', txt, re.M)
|
||||
if not m:
|
||||
return have, want, False
|
||||
indent = m.group(1)
|
||||
new = txt[:m.end(1) + len(m.group(0)) - len(m.group(0).lstrip())] # กันพลาด
|
||||
ins = m.group(0) if m.group(0).rstrip().endswith(",") else m.group(0).rstrip() + ","
|
||||
eol_s = eol.decode()
|
||||
new = txt.replace(m.group(0), ins + eol_s + indent + '"updated": "' + want + '",', 1)
|
||||
|
||||
try:
|
||||
json.loads(new)
|
||||
except Exception as e:
|
||||
print(f" !! JSON พังหลังแก้ — ข้ามไฟล์นี้ ({e})")
|
||||
return have, want, False
|
||||
|
||||
if not dry:
|
||||
p.write_bytes(new.encode("utf-8"))
|
||||
return have, want, True
|
||||
|
||||
|
||||
def main():
|
||||
files = sorted(D.glob("schedules*.json"))
|
||||
if not files:
|
||||
print(f"ไม่พบไฟล์ใน {D}")
|
||||
return 1
|
||||
print(f"สแกน {len(files)} ไฟล์ · วันที่อ้างอิง = mtime ของไฟล์ (เวลาไทย UTC+7)")
|
||||
print("ไฟล์ เดิม → ใหม่ สถานะ")
|
||||
print("-" * 68)
|
||||
n_chg = 0
|
||||
for p in files:
|
||||
old, new, changed = stamp_file(p)
|
||||
if new is None:
|
||||
print(f"{p.name:<24} (ไม่มี route_id — ข้าม)")
|
||||
continue
|
||||
mark = "แก้ไข" if changed else "ตรงแล้ว"
|
||||
if changed:
|
||||
n_chg += 1
|
||||
print(f"{p.name:<24} {old or '(ไม่มี)':<12} → {new:<12} {mark}")
|
||||
print("-" * 68)
|
||||
if dry:
|
||||
print(f"รวมจะแก้ {n_chg} ไฟล์ (dry run — ยังไม่เขียนจริง) · รันโดยไม่ใส่ --check เพื่อเขียน")
|
||||
else:
|
||||
print(f"เขียนแล้ว {n_chg} ไฟล์")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user