Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何将 CLLocationcoordiante 转换为双精度,以便我可以对其进行算术运算并使用它们的大小比较坐标?在(ios 的swift)
CLLocationCoordinate2D是 structlatitude并且longitude都定义为CLLocationDegreeswhich 本身是double.
CLLocationCoordinate2D
latitude
longitude
CLLocationDegrees
double
以下代码在代码中创建了一个位置,但它也可以由 MapKit 函数提供:
var location = CLLocationCoordinate2D(latitude: 10.30, longitude: 44.34)
您现在可以通过调用location.latitude和访问这些值location.longitude。
location.latitude
location.longitude