Docs · Validation & I/O · Generate shapes from stops

Generate shapes from stops

For a feed with no route geometry, GTFS·X can build shapes.txt automatically: group trips into unique stop patterns, route each one along the street network (or connect the stops with straight lines), and link the result back onto every trip that follows it. One recipe, reachable from two places in the editor, fully undoable.

What it is

Without shapes.txt, a rider-facing trip planner draws a straight line between consecutive stops instead of following the street a bus actually drives. Generate shapes from stops closes that gap. It groups every trip that lacks usable geometry by its exact ordered sequence of served stops (same route, same direction, same stops in the same order), then builds one shape per unique sequence and writes the new shape_id back onto every trip that shares it.

The result is real geometry where there was none: instant if you pick straight lines, or road-following if you let it snap.

Who needs this

Feeds authored in a spreadsheet-style GTFS builder frequently ship with an empty shapes.txt, because drawing route geometry is an optional, more advanced step those tools don't require. National RTAP's GTFS Builder is the common example: an agency fills in routes, stops, and schedules in a guided Excel workbook, exports a feed, and never touches shapes.

That feed isn't broken. It's valid GTFS, and it will import and validate cleanly in GTFS·X. It just renders as crow-flies straight lines between stops in every consumer app until it has geometry, which looks unfinished next to services whose map shows the bus following the actual street.

How to run it

Two entry points open the same dialog:

Right after importing a shapeless feed

When GTFS·X detects, on import, that the feed has no usable route geometry, a callout offers to generate shapes right away, before you start editing.

Any time, from Validation

A feed with no route geometry always carries a "no route geometry" warning in the Validation panel. Select it and the right-rail fix recipe shows a Generate shapes button; click it to open the dialog on demand, whenever you're ready.

Both paths land on the same preview: how many stop patterns need geometry, across how many routes, and how many trips will be linked once you run it.

Choosing a mode

One shape per stop pattern

Trips are grouped by route, direction, and the exact ordered list of served stops, not one shape per trip. Two trips that visit the same stops in the same order (the normal case for most scheduled service) share a single generated shape; only trips whose stop sequence actually differs (a short-turn, an express that skips stops, a loop) get their own. On a real National RTAP feed used to validate this recipe, 86 trips collapsed to 19 unique stop patterns, so 19 shapes covered the whole feed.

Reviewing the result

When the run finishes, the summary reports how many shapes were created and how many trips were linked, plus three outcomes worth a second look:

The whole run is undoable in one step from the result screen. After committing, a generated shape is just a shape: open the route in Routes & shapes, find it under that route's Shapes tab, and use Edit Shape, Simplify, Trim, or re-Snap on it like anything you'd drawn by hand.

Limits

See also