cd /news/ai-agents/smogcheck-offline Β· home β€Ί topics β€Ί ai-agents β€Ί article
[ARTICLE Β· art-149067] src=dev.to β†— pub= topic=ai-agents verified=true sentiment=↑ positive

SmogCheck - offline

A developer built SmogCheck, an offline walking-route planner for Lahore's smog season that uses OpenStreetMap data and a local Ollama tool-calling agent to steer pedestrians away from major traffic arteries. In a 2.5 km test radius around Gulberg, the planner cut time on arterial roads from 61% to 10% on a 4,653 m route versus the 3,537 m shortest path, and found a 3,457 m park loop with 17% on major roads. The system runs entirely on a laptop with Wi-Fi off, using road class and park proximity as exposure proxies rather than live air-quality data.

by read3 min views2 publishedOct 11, 2026

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass

SmogCheck is an offline walking-route planner for Lahore's smog season. You ask it, in plain English, something like "Where can I take a 3 km walk from Gulberg?", and it plans a loop that stays off the big traffic arteries and goes through a park.

During peak smog, the usual advice is "stay indoors", but people still need to walk, and the default route from any maps app is the shortest one, which usually runs along Main Boulevard or Ferozepur Road. SmogCheck picks quieter streets and parks instead, and the whole thing runs on my laptop with Wi-Fi off.

An honest note on what it does not do: it has no live air-quality data. Offline, that isn't available. It uses proxies for exposure: road class (primary and secondary roads are penalized) and proximity to parks and mapped trees. I'd rather call it a "low-exposure route finder" than pretend it measures clean air.

Who it's for: anyone in Lahore who wants to walk or run during smog season without sending their daily routes to a cloud service.

How it gets people outside: the screen part is a single question and a map. The rest of the experience is the walk. [FILL IN: one line about where you walked.]

[FILL IN: link to a short screen recording, made with Wi-Fi off. Show: the question typed in, the answer, and result.html opening with the route.]

One real result from my test area (a 2.5 km radius around Gulberg):

Route Distance On major roads
Shortest path 3,537 m 61%
SmogCheck 4,653 m 10%

About 1.1 km of extra walking for an 84% cut in time spent on arterial roads. For the loop query, the planner found a 3,457 m round trip with 17% on major roads, through a 12.5 ha park.

[FILL IN: screenshot of the red (shortest) vs blue (SmogCheck) map.]

[FILL IN: embed your GitHub repo here, e.g. {% embed https://github.com/algo-abdullah/smog-check %}]

smogcheck/
β”œβ”€β”€ data prep      # download + save the OSM graph, parks, trees
β”œβ”€β”€ score.py       # exposure-based edge costs
β”œβ”€β”€ parks.py       # park-loop generator
└── agent.py       # Ollama tool-calling agent

Open-source pieces

The data. I downloaded OpenStreetMap data once for a 2.5 km radius around Gulberg: a walking graph (5,327 nodes, 14,546 street segments), 77 park polygons and 222 mapped trees. After that, everything is saved locally.

The scoring. Every street segment gets a cost. Lower cost means a better route:

edges["cost"] = edges["length"] * (
    1 + 2.0 * edges["major"]            # penalize primary/secondary roads
      - 0.8 * edges["park_frac"]        # reward segments inside parks
      - 0.1 * (edges["trees"] / 5).clip(upper=1)   # small bonus for nearby trees
)

Then plain Dijkstra over cost instead of length.

The loop finder. My first idea was to reward park segments in the cost function. It barely worked, because OSM has few mapped footpaths inside Lahore's parks (only 274 of 14,546 segments touch a park). So instead, the loop planner treats parks as destinations: it routes to each park, comes back by a different path (reusing the outbound streets costs 3x), and picks the one closest to the requested distance.

The AI part. The model doesn't do any routing. A 3B model is bad at geometry, so I gave it two tools, plan_route and plan_park_loop. The model reads the question, picks a tool and its arguments, and then explains the result. The routing stays deterministic and testable.

What went wrong

llama-server), and a clean reinstall solved it. [FILL IN. This is the part judges look for. Suggestions: where you started, what time of day, how long it took, how the route felt compared with the main road, any place where the map was wrong (a closed gate, a missing path, a street that turned out to be busy), and 2-3 photos.]

[FILL IN: list any partner categories from the challenge page that apply, or delete this section.]

── more in #ai-agents 4 stories Β· sorted by recency
── more on @smogcheck 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/smogcheck-offline] indexed:0 read:3min 2026-10-11 Β· β€”