Notes


#1

So far there is one problem between OSM map tile and mapbox. They ain’t aligned well. Maybe we have to deal with it another way.

Ref:

Map Tile

using Transport’s Thunderforest service seems to be a pretty good fit. Until we have any meaningful load, this is it.

Geocoding

  1. Nominatim’s OSM engine, it’s policy on main server - this is not full text search
  2. Pelias :star: 1300 :star: based on ElasticSearch
    • OSM data & others
  3. Photon :star: 600 :star: based on ElasticSearch
    • OSM data

pelias services

it uses roughly 4GB of RAM and 15GB of storage to run in Thailand (no openaddresses, no interpolation from default pelias-docker compose)

CONTAINER ID        NAME                      CPU %               MEM USAGE / LIMIT     MEM %              
172564ec25c1        pelias_placeholder        0.00%               108.4MiB / 12.72GiB   0.83%              
24ad78cd15f7        pelias_pip-service        0.00%               213.5MiB / 12.72GiB   1.64%              
fa289691f21b        pelias_elasticsearch      0.39%               510.3MiB / 12.72GiB   3.92%             
7be3e1cceeb6        pelias_libpostal          0.00%               1.896GiB / 12.72GiB   14.90%            
24aa68e2fdab        pelias_document-service   0.00%               43.89MiB / 12.72GiB   0.34%        
8f4e4ad8df73        pelias_api                0.00%               35.5MiB / 12.72GiB    0.27% 

Routing

อันนี้น่าจะดูดีสุดละ goabout/opentripplanner สิ่งที่ต้องมีคือ .osm หรือ .pbf และก็ GTFS feed ตัว Graph.obj สร้างใน memory อย่างเดียวไปเลยไม่ต้องมาเป็น file สำหรับแค่ phuket ก็ 500MB RAM แต่ถ้าเป็นทั้ง bkk และ phuket ก็ขึ้นมา 1.5GB RAM

docker run \
    -e JAVA_MX=2G \
    -v $PWD:/data \
    -p 8080:8080 \
    goabout/opentripplanner \
    otp --build /data --inMemory

อันนี้ดึง latest opentripplanner เลย

:asterisk: ถ้าอยากจะได้ analyst ด้วยก็ใส่ --analyst ไปตามปกติ

UI

Routing UI

Leaflet Routing machine

This still requires routing backend osrm-backend and geocoding service too.

Project OSRM contains [1] osrm-frontend [2] osrm-backend


#2

OTP request

GET /otp/routers/default/plan?

transit

fromPlace: 7.908951963874835,98.33304405212401
toPlace: 7.880471202958928,98.41166496276855
time: 5:43pm
date: 09-06-2018
mode: TRANSIT,WALK
maxWalkDistance: 8046.7
arriveBy: false
wheelchair: false
locale: en

bike + transit

fromPlace: 7.908781935309869,98.33184242248535
toPlace: 7.880471202958928,98.41166496276855
time: 10:43am
date: 09-06-2018
mode: TRANSIT,BICYCLE
maxWalkDistance: 3218.68
arriveBy: false
wheelchair: false
locale: en

park + ride

อันนี้มันคือ ขับรถละขึ้น train

fromPlace: 7.908781935309869,98.33184242248535
toPlace: 7.880471202958928,98.41166496276855
time: 10:43am
date: 09-06-2018
mode: CAR_PARK,WALK,TRANSIT
maxWalkDistance: 3218.68
arriveBy: false
wheelchair: false
locale: en

drive only

fromPlace: 7.908781935309869,98.33184242248535
toPlace: 7.883446896641537,98.40188026428223
time: 10:43am
date: 09-06-2018
mode: CAR
maxWalkDistance: 3218.68
arriveBy: false
wheelchair: false
locale: en


#3

Stop

query stops from max, min lat lon

https://otp.goth.app/otp/routers/default/index/stops?
maxLat=7.894754337408049&
minLon=98.34475994110107&
minLat=7.861511281203057&
maxLon=98.40179443359374

response json

[ { id: 'stop_id', name: 'name', lat: 1, lon: 1 }, ... ]

query bus line at particular stop

https://otp.goth.app/otp/routers/default/index/stops/1:pt-1-41/routes

response json

[
  {
    "id": "1:kamala-phuket",
    "shortName": "Kamala-Surin-Phuket",
    "longName": "หาดกมลา หาดสุรินทร์ เชิงทะเล ภูเก็ต",
    "mode": "BUS",
    "color": "4C9FFF",
    "agencyName": "โพถ้อง สีฟ้า"
  },
  ...
]   

detail about stop

https://otp.goth.app/otp/routers/default/index/stops/2:AB02

response json

 {
  "id": "2:AB02",
  "name": "Phantep Condotown",
  "lat": 7.88795290634,
  "lon": 98.379971981,
  "desc": "พันเทพคอนโดทาวน์",
  "locationType": 0,
  "wheelchairBoarding": 0,
  "vehicleType": -999,
  "vehicleTypeSet": false
}

timetable at the stop

https://otp.goth.app/otp/routers/default/index/stops/4:A08/stoptimes

response json

[
  {
    "pattern": {
      "id": "4:PKSB-NIGHT-A:0:01",
      "desc": "PKSB NIGHT RUN A"
    },
    "times": [
      {
        "stopId": "4:A08",
        "stopIndex": 1,
        "stopCount": 4,
        "scheduledArrival": 76800,
        "scheduledDeparture": 76800,
        "realtimeArrival": 76800,
        "realtimeDeparture": 76800,
        "arrivalDelay": 0,
        "departureDelay": 0,
        "timepoint": true,
        "realtime": false,
        "realtimeState": "SCHEDULED",
        "serviceDay": 1542646800,
        "tripId": "4:PKSBNA01",
        "headsign": "Kata Night Plaza"
      },
      ...
    ]
  },
  ...
]