Staigāt pa dzelzceļa līnijā, ir bīstami.

The Latvian phrase needs to be re-edited. The use of any preposition – in this case “pa” in combination with a direct object in the plural form requires the use of the Dativ case.
Staigāt pa dzelzceļa līnijām ir bīstami .