A
A
Arman2016-06-18 14:09:57
Objective-C
Arman, 2016-06-18 14:09:57

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)

Google Maps:
11.6127
How can one change from one to another?
Thanks in advance.
up.
those. I need to remake the MKCoordinateSpan MapKit structure into a zoom for Google Maps. In the first option, there is a delta of latitude and longitude, and in the second, it’s just a fractional number for zoom
with coordinate points, there are no problems, it turned out to put the map in the center of coordinates, but I don’t know how to zoom, at least approximate. Completely different data types.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Marunko, 2016-06-20
@Antonio-banderas

https://github.com/johndpope/MKMapViewZoom
in the same description there is a link to an article where all this code is essentially explained

A
Anton Zhilin, 2016-06-18
@Anton3

If you just need to convert the number type from Doubleto 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 question

Ask a Question

731 491 924 answers to any question