Answer the question
In order to leave comments, you need to log in
How to convert MapKit MKCoordinateSpan to Float|Int for Google Maps?
Good day.
I have been looking for a solution for several days, but everyone is silent about this.
MapKit works with zoom through MKCoordinateSpan ((latitudeDelta: CLLocationDegrees, longitudeDelta: CLLocationDegrees)), CLLocationDegrees - Double.
Google Maps works with Float (1...20)
MKCoordinateSpan example:
MKCoordinateSpan(latitudeDelta: 5.8416395568108328, longitudeDelta: 4.3938483920286444)
11.6127
Answer the question
In order to leave comments, you need to log in
https://github.com/johndpope/MKMapViewZoom
in the same description there is a link to an article where all this code is essentially explained
If you just need to convert the number type from Double
to Float
, then in Swift this is done using the constructor:
let coordinateSpan: MKCoordinateSpan = ...
let latitudeFloat = Float(coordinateSpan.latitudeDelta)
let longitudeFloat = Float(coordinateSpan.longitudeDelta)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question