Inspiration

5:30 AM on the Texas Gulf Coast. A crop-duster is about to spray a field that runs along a river. The insecticide's label is 35 pages long, and somewhere on page 7 it says how far to stay from water: 150 feet from the air, 25 feet from the ground, 450 feet for ultra-low-volume spraying.

That label is federal law. The chemical inside is, in the label's own words, "extremely toxic to fish and aquatic invertebrates." But the distance lives in a PDF and the river lives on a map, and the only thing joining them is the applicator's memory and a guess by eye.

We wanted to draw page 7 on the field.

What it does

Pick a pesticide label (six real EPA labels are built in, or upload your own) and draw your field.

  1. Gemini reads the label and pulls out every rule about water, wind and spray method, with the page it came from.
  2. LabelLine checks each quote against the PDF and highlights it on the page. If the sentence or its numbers aren't really there, nothing gets drawn.
  3. You confirm the rules you trust.
  4. The map draws the no-spray zones around federal stream and wetland data, plus any pond or ditch you add, and shows how many acres are left outside them.
  5. Switch aerial to ground and every zone redraws. Click a zone and the PDF jumps to the sentence behind it.

A wind forecast, a pre-spray checklist and a printable record finish the job. It's a screening aid: the label and the applicator still make the call.

The hosted demo plays recorded real Gemini runs for the six sample labels, marked REPLAY.

How we built it

  • Gemini API reads the PDF directly and returns structured JSON: rule type, spray method, crop, distance, a short quote and its page.
  • pdf.js finds every quote in the label's own text. Numbers must match exactly, so "15" never passes for "150".
  • Turf.js buffers USGS and USFWS water data and cuts it out of the field. Leaflet for the map, Open-Meteo for wind, Vite and TypeScript, hosted on Vercel.
  • 307 automated tests, plus an answer key of 129 quotes from six real labels to measure Gemini against.

Built by one student in 24 hours, with Claude as the AI coding agent that wrote most of the code.

Challenges we ran into

  • Label PDFs are messy: broken ligatures, hyphenated line breaks, tables split across pages. Matching quotes strictly while surviving all that was the fiddliest code we wrote.
  • The federal stream map timed out on most of our test requests, so every map layer got its own timeout and a dated backup for the demo field.
  • Gemini rejected our first real request because of two keywords in our JSON schema. We found and fixed it with hours to spare.

Accomplishments that we're proud of

  • On six real EPA labels, 95% of the rules Gemini extracted were correct, it found 73% of the rules in our answer key, and 99% of its quotes were found word for word in the PDF.
  • No zone can appear on the map without a real sentence on the page behind it.

What we learned

A quote being in the PDF doesn't make it right. Gemini can find the right sentence and still tag it with the wrong spray method, and a 450-foot aerial rule drawn for a ground sprayer is a real mistake. That's why a person confirms every rule.

What's next for LabelLine

Sit down with licensed applicators, have a pesticide expert review our answer key, and add a state selector so state-only rules can be applied.

Built With

Share this project:

Updates

Submission history