Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. @IBOutlet weak var myMapView: MKMapView!
  2. var cord1: Double = -39.849152
  3. var cord2: Double = -71.943082
  4.  
  5. var ResivedLat: String = ""
  6. var ResivedLong: String = ""
  7.  
  8. func trans(){
  9.  
  10. cord1 = Double(ResivedLat)!
  11. cord2 = Double(ResivedLat)!
  12. }
  13.  
  14. override func viewDidLoad() {
  15. super.viewDidLoad()
  16. mapTajMahal()
  17. trans()
  18. }
  19.  
  20. func mapTajMahal()
  21. {
  22. //Taj Mahal Coordinates: 27.175015, 78.042139
  23.  
  24. // Coordinates
  25. let tajLat:CLLocationDegrees = cord1
  26. let tajLong:CLLocationDegrees = cord2
  27.  
  28. let tajCoordinate = CLLocationCoordinate2D(latitude: tajLat, longitude: tajLong)
  29.  
  30. //Span
  31. let latDelta:CLLocationDegrees = 0.2
  32. let longDelta:CLLocationDegrees = 0.2
  33. let tajSpan = MKCoordinateSpan(latitudeDelta: latDelta, longitudeDelta: longDelta)
  34.  
  35. let tajRegion = MKCoordinateRegion(center: tajCoordinate, span: tajSpan)
  36.  
  37. myMapView.setRegion(tajRegion, animated: true )
  38.  
  39. let tajAnnotation = MKPointAnnotation()
  40. tajAnnotation.title = "Neltume"
  41. tajAnnotation.subtitle = "She walks in beauty"
  42. tajAnnotation.coordinate = tajCoordinate
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement