originally a group of more than a hundred islands in a marshy lagoon , it had for several centuries been a city on the water , its buildings , streets and alleyways never far from one of the maze of canals that crisscrossed and segmented it .