Maine tolls: how to maintain

Files: /srv/toll/draft/ME, last built 2026-10-09 21:33 ET · the ME toll page · map test · facts below are read from the files each time this page is built (python3 /home/geo1/system/handbuilt/maintain_pages.py ME)

Procedure for this state

The Maine Turnpike (MTA), priced entry to exit from MTA's 16 rate charts (cash and Maine Turnpike E-ZPass, classes 1-8, effective November 1, 2021). Out-of-state E-ZPass pays the cash rate; a missed toll is paid at the cash rate (non-account payment). The I-295 Gardiner plaza (Libby Hill) is priced as a point.

When to check

Rebuild

  1. python3 me_state.py: me_charts.py reads each chart from the PDF's word boxes (21 rows × 21 columns, asserted); the builder asserts the New Gloucester equalities for exits 75/80/86 and the West Gardiner single-pass cells.
  2. Full chain with ME after an OSM refresh (New England extract).

Watch out

The chain every state shares

Hosts: geo1 (192.168.50.220) holds the sources, builders, drafts, map and API; b100 (192.168.50.14) is the test client. All times are Eastern.

whatwhere (geo1 unless said)
sources list/home/geo1/maps/toll/ME/urls.txt (name <tab> URL)
archived sources/home/geo1/maps/toll/ME/sources/<name>/<YYYY-MM-DD>/ (file + meta.json: url, fetched, sha256)
builder/home/geo1/system/handbuilt/me_state.py; shared code toll_common.py
OpenStreetMap inputs/home/geo1/system/handbuilt/osm/me_* (cut from /home/geo1/maps/osm/us-latest.osm.pbf)
outputdraft /srv/toll/draft/ME/ (the builders write here); published /srv/toll/ME/ (copied from the draft by promote.py publish). The map and the API read the published page, or the draft while it is listed for review
toll enginesource /home/geo1/maps/web/tolls.js, served copy /srv/maps/tolls.js (the API runs the served copy)
API/home/geo1/maps/api/server.mjs on 127.0.0.1:8090 behind nginx /api/; pid in logs/test.pid
regression tripsb100: ~/apitest/site/cases.json, runner ~/apitest/run.py, browser check ~/apitest/browser.mjs

1. Refresh a source

  1. Fetch into a new dated folder: python3 /home/geo1/system/handbuilt/fetch_list.py ME [name ...] (no names = every line of urls.txt). A new source: add a line to urls.txt first, then fetch it by name.
  2. A site that refuses geo1 (HTTP 403) or scripts: fetch it on b100 in headless Chrome with node ~/apitest/fetch_b100.mjs <out> <name>=<url> ..., then rsync -a <out>/ geo1@192.168.50.220:/home/geo1/maps/toll/ME/sources/. Its meta.json records that it came from b100.
  3. Compare the new file with the previous dated one (diff, pdftotext -layout for PDFs). Same content: nothing to do. Changed amounts or a new effective date: rebuild (step 2) and update the expected amounts of the affected regression trips from the operator's own figures.

1b. The corpus (NJ, PA, VA start from it; DE is published from it)

python3 /home/geo1/maps/toll/bin/tollup.py ME update fetches the adapter's sources (bin/adapters/me.py), stores a document only when its content changes, writes one rate file per version under /home/geo1/maps/toll/ME/rates/ and appends every price change to history.csv (every run to runs.log). TOLL_WEB=/home/geo1/maps/toll/corpus python3 /home/geo1/maps/toll/bin/publish.py ME writes the corpus /home/geo1/maps/toll/corpus/ME from it (DE: plain publish.py DE writes /srv/toll/DE). Never hand-edit either. Then rebuild the draft (step 2) so it picks up the new rates.

2. Rebuild

3. Load it into the API and test from b100

  1. The API reads the toll pages and tolls.js when it starts. Restart it: cd /home/geo1/maps/api && kill $(cat logs/test.pid); (nohup /home/geo1/maps/node/bin/node server.mjs > logs/server.log 2>&1 & echo $! > logs/test.pid) (it is started by hand, not a service).
  2. From b100 only: python3 ~/apitest/run.py ~/apitest/site/cases.json. Every trip must be OK. Add a trip for every rate or rule you change, with the amount taken from the operator's own source.
  3. Engine change (tolls.js): edit /home/geo1/maps/web/tolls.js, check with /home/geo1/maps/node/bin/node --check, copy to /srv/maps/tolls.js with sudo install -o www-data -g www-data -m 644, restart the API, run the trips.

4. OpenStreetMap refresh (all states at once)

The builders match toll points to the OSM way ids the router drives, so the extracts here must come from the same us-latest.osm.pbf the router (Valhalla, /home/geo1/maps/valhalla_data) was built from (now 2026-09-27). New OSM data means: rebuild the router tiles, then for each state cut the box, rebuild its OSM inputs and run the full chain, then compare untied_toll_nodes.csv and the estimated positions below. The box for ME and the cutting commands are in the state's procedure above; the toll-node and way index comes from python3 tollnode_ways.py ME.

5. Publish

A rebuild writes the draft (/srv/toll/draft/ME); the published page (/srv/toll/ME) does not change. python3 /home/geo1/maps/toll/bin/promote.py review ME lists the draft for review: the map and the API then read it instead of the published page. Run the regression trips from b100. After approval, python3 /home/geo1/maps/toll/bin/promote.py publish ME copies the draft to /srv/toll/ME (the previous page is kept under /home/geo1/maps/toll/ME/published/<time>/) and takes it off the review list. After a change, update the coverage line for ME in the API page (/api.html, generator /home/geo1/maps/api/doc/api_page.py) and rebuild this page: python3 /home/geo1/system/handbuilt/maintain_pages.py ME.

Sources (20)

Each fetch is kept in its own dated folder under /home/geo1/maps/toll/ME/sources/<name>/; the builder always reads the newest one, so a new fetch takes effect at the next rebuild and the old one stays for comparison.

sourcefetched (newest)fetches kepthowlisted in urls.txtrows using it
maine_dot_interstate_mileposts
https://arcgisserver.maine.gov/arcgis/rest/services/mdot/MaineDOT_Feature/MapServer/16/que
2026-10-091fetch_list.pyyes
mta_cash_class1
https://maineturnpike.com/getattachment/43c501e7-9aa2-4807-a017-fd1934f3ffe8/CashRateChart
2026-10-091fetch_list.pyyes255
mta_cash_class2
https://maineturnpike.com/getattachment/8c070a8a-ce24-4133-b12b-418c6d087c5c/CashRateChart
2026-10-091fetch_list.pyyes255
mta_cash_class3
https://maineturnpike.com/getattachment/0cdbe1c3-0c36-4822-ace0-cf4fbbe46c00/CashRateChart
2026-10-091fetch_list.pyyes255
mta_cash_class4
https://maineturnpike.com/getattachment/bc77d527-469c-4049-a53a-dd22a8cd9fa9/CashRateChart
2026-10-091fetch_list.pyyes255
mta_cash_class5
https://maineturnpike.com/getattachment/c14186bb-db8d-48e7-bfe6-a42ce6c5341a/CashRateChart
2026-10-091fetch_list.pyyes255
mta_cash_class6
https://maineturnpike.com/getattachment/4ed6cf26-1928-4fb1-91f4-ad98bfae2ce7/CashRateChart
2026-10-091fetch_list.pyyes255
mta_cash_class7
https://maineturnpike.com/getattachment/e993ded0-0b11-4f67-90c0-e11623bad68c/CashRateChart
2026-10-091fetch_list.pyyes255
mta_cash_class8
https://maineturnpike.com/getattachment/8968d5e4-b379-4d60-a680-6a83b3552b79/CashRateChart
2026-10-091fetch_list.pyyes255
mta_ezpass_class1
https://maineturnpike.com/getattachment/cdb75432-119b-4fd9-b5ed-8da4482b4178/E-ZPassRateCh
2026-10-091fetch_list.pyyes255
mta_ezpass_class2
https://maineturnpike.com/getattachment/87c2f6be-3832-48a3-a56a-95e05963ec28/E-ZPassRateCh
2026-10-091fetch_list.pyyes255
mta_ezpass_class3
https://maineturnpike.com/getattachment/dd2eed95-c59c-4bc6-bef4-d4ca2dbbe653/E-ZPassRateCh
2026-10-091fetch_list.pyyes255
mta_ezpass_class4
https://maineturnpike.com/getattachment/8b17c233-0330-4f93-9470-bb8878d1db13/E-ZPassRateCh
2026-10-091fetch_list.pyyes255
mta_ezpass_class5
https://maineturnpike.com/getattachment/1c673c5b-0ccd-4566-9dc6-ce60f29c3856/E-ZPassRateCh
2026-10-091fetch_list.pyyes255
mta_ezpass_class6
https://maineturnpike.com/getattachment/5d2b4b9e-5a00-4d5e-ab5f-61b214704d8f/E-ZPassRateCh
2026-10-091fetch_list.pyyes255
mta_ezpass_class7
https://maineturnpike.com/getattachment/a16e4190-3aa4-4050-bcd4-6953a06ed892/E-ZPassRateCh
2026-10-091fetch_list.pyyes255
mta_ezpass_class8
https://maineturnpike.com/getattachment/9ab56aa2-4815-4532-88ac-fa6a708b7948/E-ZPassRateCh
2026-10-091fetch_list.pyyes255
mta_non_account_payment
https://maineturnpike.com/traveler-services/non-account-payment
2026-10-091fetch_list.pyyes
mta_tolls_page
https://maineturnpike.com/Traveler-Services/Tolls
2026-10-091fetch_list.pyyes2
mta_volume_discount
https://maineturnpike.com/Traveler-Services/Tolls/Volume-Discount-Program.aspx
2026-10-091fetch_list.pyyes

Facilities (2)

idfacilityoperatorpointsrate / trip rowseffective dates in the rowssource
ME-MTAMaine TurnpikeMaine Turnpike Authority (MTA)1740642021-11-01mta_tolls_page
ME-MTA-I295GMaine Turnpike - I-295 Gardiner plazaMaine Turnpike Authority (MTA)1162021-11-01mta_tolls_page

Positions placed by estimate (0): re-check when OpenStreetMap or the operator changes

None: every position comes from an official layer or a mapped toll node.

Decisions by rule

R2a: 18, direction: 18, no: 1, not: 1, plan: 1 (all in decisions.csv).

Open gaps (0)

None.

Untied OSM toll nodes: 74

Toll booths / gantries mapped in OpenStreetMap on or near this state's roads that no toll point claims; a route through one lists it under unpriced. After an OSM refresh, look at new ones here (untied_toll_nodes.csv): a new gantry on a priced road means a point is missing.

Regression trips for ME (5)

Run from b100 (never on geo1): python3 ~/apitest/run.py ~/apitest/site/cases.json. Every trip must come back OK; a changed amount is either a rate change (update the expected amount from the operator's own source) or a fault.

tripexpected
ME Wells -> Kittery (19 -> York), cash ($4.00, MTA chart)$4.00
ME Wells -> Kittery, Maine E-ZPass ($0.95)$0.95
ME Gray -> Auburn (63 -> New Gloucester), cash ($2.25)$2.25
ME I-295 Gardiner plaza (Libby Hill), Maine E-ZPass ($0.50)$0.50
ME Kittery -> Augusta, NJ E-ZPass pays cash: York -> 44 $5.00 + Libby Hill $1.00$6.00