Narrated Yahya bin Ishaq:
I heard Anas saying, “We travelled with the Prophet from Medina to Mecca and offered two Rakat (for every prayer) till we returned to Medina.” I said, “Did you stay for a while in Mecca?” He replied, “We stayed in Mecca for ten days.”
Distance between Makkah and Madinah = 338.9 km (approx.)
The majority of scholars defined the distance at which a traveller may shorten his prayers; and some of them did not set a limit, rather they left that to be decided by custom (al-‘urf) – what is customarily regarded by the people as travelling is where the concession is granted allowing the traveller to shorten his prayers and break his fast.
According to the majority of scholars, the distance is defined as being approximately eighty kilometers.
It says in Fataawa al-Lajnah al-Daa’imah (8/99): The distance in which the concession of traveling is allowed is that which is customarily regarded as travelling, which is approximately eighty kilometers. Whoever is going to travel this distance or more is allowed to avail himself of the concessions granted to travellers, namely wiping over the socks for three days and nights, and joining and shortening prayers, and not fasting in Ramadaan.
..And there is no difference between travel by land or by sea.
[Taken from IslamQA]
So travelling within a city or close by does not mean you can shorten prayers. Minimum distance defined above.