Created
May 13, 2016 17:39
-
-
Save DonMag/aa961041ac88a304336fe9edf4c006fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do { | |
let jsonDict = try NSJSONSerialization.JSONObjectWithData(fileContents!, options: []) as! NSDictionary | |
if let features = jsonDict["features"] as? [Dictionary<String, AnyObject>] { | |
// try this | |
var oneFeature = features[0]["geometry"]!["coordinates"]!![0][3] | |
for feature in features { | |
if let geometry = feature["geometry"] as? Dictionary<String, AnyObject> { | |
if let coordinates = geometry["coordinates"] as? Dictionary<Int, AnyObject> { | |
let coordinatesPair = coordinates[0] | |
// let path = GMSMutablePath() | |
// for coords in coordinatesPair { | |
// let longitude = coords[0].doubleValue | |
// let latitude = coords[1].doubleValue | |
// // print("Latitude: \(latitude), Longitude: \(longitude)") | |
// | |
// path.addCoordinate(CLLocationCoordinate2D(latitude: latitude, longitude: longitude)) | |
// } | |
// | |
// let polyline = GMSPolyline(path: path) | |
// polyline.strokeColor = UIColor.redColor() | |
// polyline.strokeWidth = 5 | |
// polyline.map = mapView | |
} | |
} | |
} | |
} | |
} catch let error as NSError { | |
print("Failed to load: \(error.localizedDescription)") | |
} catch { | |
} |
erica
commented
May 13, 2016
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment