Ankit Patel
WritingPapersLabsAboutContact
Personal & Reflections··1 min read·542 views

500 Degrees

The whole map spans about 402 degrees corner to corner, while the generated query asked for everything within 500

Two weeks after ChatGPT's launch, what strikes me first is asking for software in plain English. The hard part is catching silent unit errors.

Ask for a routine spatial lookup: find venues within 500 meters of -73.9857, 40.7484. When venues.geom stores WGS 84 coordinates as PostGIS geometry(Point, 4326), an unguarded SQL draft looks completely idiomatic:

SELECT *
FROM venues
WHERE ST_DWithin(
  geom,
  ST_SetSRID(ST_MakePoint(-73.9857, 40.7484), 4326),
  500
);

The prompt asked for meters. The SQL asked for 500 degrees.

In PostGIS, ST_DWithin interprets distance in the spatial reference system's native units. On geometry(Point, 4326), 500 degrees wraps the entire globe and returns every non-null row in the table without raising a single warning or syntax error.

Dividing 500 by 111,000 to approximate degrees doesn't fix it cleanly either, because a degree of longitude shrinks toward the poles. Casting to geography enforces spherical distance in meters and needs a matching expression index to avoid scanning the table:

SELECT *
FROM venues
WHERE ST_DWithin(
  geom::geography,
  ST_SetSRID(ST_MakePoint(-73.9857, 40.7484), 4326)::geography,
  500
);

Natural language removes the friction of remembering exact function signatures, which shifts engineering effort straight into verification. Any 'ask your data' product built on an LLM has to surface its intermediate assumptions visually: the parsed point, the radius in meters, the index plan and a sanity check on returned row counts, backed by typed domain functions so generated queries don't reinvent coordinate math on every prompt.

Generating plausible code just got dramatically cheaper. Checking whether 500 meters stayed 500 meters is now the real job.

Continue in Personal & Reflections