【问题标题】:Firebase Firestore Save Placemark vs only CoordinatesFirebase Firestore 保存地标与仅坐标
【发布时间】:2020-06-13 21:07:11
【问题描述】:

我需要在我的表中保存两个地标。一个用于位置,一个用于目的地。 我现在正在做的是创建一个包含所有详细信息的字典,如下所示:

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。然后我将其解析为我的 Placemark 模型(不是 CLPlacemark)。

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

那么实际上哪个更好?

【问题讨论】:

    标签: ios swift firebase google-cloud-firestore geolocation


    【解决方案1】:

    最好只保存坐标。这样,如果位置名称发生变化,保存的地标就不会过时。

    【讨论】:

      猜你喜欢
      • 2020-12-22
      • 1970-01-01
      • 2020-05-24
      • 2013-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-31
      • 1970-01-01
      相关资源
      最近更新 更多