Train tracks, especially in rural areas, more often than not, go through towns and villages. I'm somewhat familiar with the Lac-Megantic area of Quebec and it's rural. Closest thing to a city in the immediate area is probably Sherbrook.
In most cases the towns were built around the tracks, often as the site of a refuelling station.