Talk:Block Detection Methods
RFID is getting very cheap, the tags are literally pennies, the costly part is the sensor. They are rather large and could be hidden in a building or placed below the roadbed. You could figure out not only that a train is there, but every tagged vehicle will be known as it passes the sensor.
Problem is, to establish direction multiple sensors are needed. They feed the computer and it can calculate where it is and the direction of travel.
Sensors are about $40 each right now.