Complex sentence: The districts are based mostly on historical divisions, and several are former towns annexed by the city of Barcelona in the 18th and 19th centuries that still maintain their own distinct character.
Split into simpler sentences: The districts are based mostly on historical divisions. Several of the city's districts are former towns annexed by the city of Barcelona in the 18th and 19th centuries that still maintain their own distinct character.