Srirangapatna lies on a single track where the line goes between Mysore and Bangalore. It's located just to the west of the town but there's only a few trains that stop here so you're far better off getting a bus from Mysore.
Mini-buses to Srirangapatna depart from near the clock tower on Chandragupta Road. However, they wait until there's enough passengers on board and even drive around a bit to find more before heading off towards Srirangapatna. Even though it's only 16km (10 miles) away it took us an hour as the driver I had was going at a snail’s pace in order to pick up more people along the way which I and a few other passengers got angry about. The bus will drop you off on the main road, south of the town and you'll have to walk the rest which isn't far. The bus cost me Rs10.