แผนที่จาก 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
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user