Firebase Firestore保存地标vs仅坐标

问题描述 投票:1回答:1

我需要在表格中保存两个地标。一种用于位置,一种用于目的地。我现在正在做的是即时通讯创建具有以下所有详细信息的字典:

let location: [String: Any] = [
    "coordinate": GeoPoint(latitude: item.location.coordinate.latitude , longitude: item.location.coordinate.longitude),
    "name": item.location.name,
    "isoCountryCode": item.location.isoCountryCode,
    "country": item.location.country,
    ...etc 
]

然后我将其保存到Firestore。然后,我将其解析为我的地标模型(不是CLPlacemark)。

最近,我在考虑是否最好只保存坐标然后使用GeoCodergeocoder.reverseGeocodeLocation(location, completionHandler: { (placemarks, error) in获取地标。

那么哪个更好?

ios swift firebase google-cloud-firestore geolocation
1个回答
0
投票

最好只保存坐标。这样,如果发生位置名称更改之类的事情,保存的地标将不会过时。

© www.soinside.com 2019 - 2024. All rights reserved.