Certain navigating insects home in on their goal by moving so that currently viewed images of landmarks fall on the same retinal locations memorized during previous visits. Here we show that ants can use similar retinotopic learning to guide lengthy routes, by memorizing and walking parallel to a distinct visual edge. We induced workers of the ant Leptothorax albipennis to travel parallel to a prominent wall. When the wall’s height was changed, the ants’ paths consistently shifted toward a lowered wall and away from a raised wall, as would be expected if they attempt to keep the wall’s image at a constant retinal position. These path shifts were smaller than would be expected if the wall was the only guide to navigation, suggesting that other cues are also important. Significantly larger shifts were seen when edge guidance was enhanced by using two walls, one on each side of the path.