870. When One's Techum Ends in a Town
Shabbos 27:7
If a city or cave that starts within one's Shabbos limit extends 1,001 cubits, then that person may only walk the 1,000 cubits to the end of his 2,000 cubits.
Shabbos 27:8
If a person's Shabbos boundary falls in the middle of a town, he is permitted to move an object to anywhere within that town by throwing it. If a person spends Shabbos in a valley and non-Jews erects an enclosure all around him on Shabbos, he is still limited to 2,000 cubits in each direction, even if this limit falls within the enclosure. He may, however, move an object to anywhere within the enclosure by throwing it as long as the enclosure was erected for dwelling purposes.