Skip to content

Instantly share code, notes, and snippets.

@kiliankoe
Last active July 21, 2016 09:44
Show Gist options
  • Save kiliankoe/29b6ad308f7d25496054614fe1ae09b7 to your computer and use it in GitHub Desktop.
Save kiliankoe/29b6ad308f7d25496054614fe1ae09b7 to your computer and use it in GitHub Desktop.
Coord pairs
let coords = [
13.723288596942021,
51.02547875103679,
13.723312997594022,
51.02553463039252,
13.723399424330877,
51.02551749405676
]
let lats = coords.enumerated().filter({ $0.offset % 2 == 0 }).map { $1 }
let lngs = coords.enumerated().filter({ $0.offset % 2 != 0 }).map { $1 }
for pair in zip(lats, lngs) {
print(pair)
}
// (13.723288596942021, 51.025478751036793)
// (13.723312997594022, 51.025534630392521)
// (13.723399424330877, 51.025517494056757)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment