title: Convert CLLocationCoordinate2D coordinates to CGPoint Swift
body: <p>I have a Google Map in iOS Swift app. And i am trying to get CGPoint position for my current user coordinate so that i can apply some animation around. But I am not able to get position in CGPoint for my coordinates. </p>
  
  <p>I am basically trying to add Pulse Animation for my current user marker. Here is my code for animation - </p>
  
  <pre><code>class Pulsing: CALayer {
      var animationGroup = CAAnimationGroup()
  
      var initialPulseSacle:Float = 0
      var nextPluseAfter:TimeInterval = 0
      var animationDuration:TimeInterval = 1.5
      var radius:CGFloat = 200
      var numberOfPulse:Float = Float.infinity
  
      override init(layer: Any) {
          super.init(layer: layer)
      }
  
      required init?(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)
      }
  
      init(numberOfPulse:Float = Float.infinity, radius:CGFloat, position:CGPoint){
              super.init()
              self.backgroundColor = UIColor.blue.cgColor
              self.contentsScale = UIScreen.main.scale
              self.opacity = 0
              self.radius = radius
              self.position = position
  
              self.bounds = CGRect(x: 0, y: 0, width: radius*2, height: radius*2)
              self.cornerRadius = radius
  
              DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async {
                  self.setupAnimationGroup()
  
                  DispatchQueue.main.async {
                      self.add(self.animationGroup, forKey: "pulse")
                  }
              }
  
      }
      func createScaleAnimation () -&gt; CABasicAnimation{
          let scaleAnimation = CABasicAnimation(keyPath: "transferm.scale.xy")
          scaleAnimation.fromValue = NSNumber(value: initialPulseSacle)
          scaleAnimation.toValue = NSNumber(value: 1)
          scaleAnimation.duration = animationDuration
          return scaleAnimation
      }
      func createOpacityAnimation () -&gt; CAKeyframeAnimation{
          let opacityAnimation = CAKeyframeAnimation(keyPath: "opacity")
          opacityAnimation.duration = animationDuration
          opacityAnimation.values = [4.0, 8.0, 0]
          opacityAnimation.keyTimes = [0, 0.2, 1]
          return opacityAnimation
      }
  
      func setupAnimationGroup(){
          self.animationGroup = CAAnimationGroup()
          self.animationGroup.duration = animationDuration + nextPluseAfter
          self.animationGroup.repeatCount = numberOfPulse
          let defaultCurve = CAMediaTimingFunction(name: kCAMediaTimingFunctionDefault)
          self.animationGroup.timingFunction = defaultCurve
          self.animationGroup.animations = [createScaleAnimation(),createOpacityAnimation()]
      }
  
  }
  </code></pre>
  
  <p>And then this is how I am calling it in my setup marker method - </p>
  
  <pre><code>func setuplocationMarker(coordinate: CLLocationCoordinate2D,address:String) {
          locationMarker = GMSMarker(position: coordinate)
          locationMarker.map = viewMap
          locationMarker.title = address
          locationMarker.appearAnimation = GMSMarkerAnimation.pop
          locationMarker.icon = GMSMarker.markerImage(with: UIColor.red)
          locationMarker.opacity = 0.75
  
          let pulse = Pulsing(numberOfPulse: 1, radius: 80, position:CGPoint(x: CGFloat(Float(coordinate.latitude)), y: CGFloat(Float(coordinate.longitude))))
          pulse.animationDuration = 0.8
          pulse.backgroundColor = UIColor.blue.cgColor
          self.view.layer.insertSublayer(pulse, below: locationMarker.layer)
      }
  </code></pre>
  
  <p>With this code it shows the pulse animation at the top let corner, not around the location marker. How do i get the correct cgpoint position for my marker. Thanks in Advance!</p>