The town is (located) 20 km southeast of city X
Is southeast an adjective being modified by of city X (an adverb phrase) and having 20 km (an adverb) modifying it?
Or is 20km an adjective modifying southeast (a noun) and of city X an adjective phrase modifying southeast?
Does having located change anything?
Please explain the word classes, phrases, and which is modifying which.
I am really confused with prepositions (space/time words). I know that a prepositional phrase can be either an adjectival or adverbial phrase.