If you haven't read "The Inverted World" by Christopher Priest you should!
"A uniquely powerful novel of a society in decay. On a planet whose very nature is a mystery a massive decrepit city is pulled along a massive railway track, laying the line down before it as it progresses into the wilderness."
I read it many years ago and it gave me lots of inspirationů
...I felt it needed a Deus ex Machina at the endů :/
Beware of spoilers in the wiki article!!! : [link]
This is a wide view of an earlier image: