mapbox / mapbox/MapboxGeocoder.swift

Expected fields do not always appear in the MBGeocodedPlacemark

未關閉
#167 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

bug
主要語言
Swift
星號
133
分支
46
PR 合併指標
30 天內沒有已合併 PR

描述

Using v0.10.0.

If I reverse geocode a point in the water of the San Francisco Bay, "California" does not appear as an administrativeRegion on the MBGeocodedPlacemark. If I print the addressDictionary of the placemark, I see that the name is California, but it is not placed under the state key.

Sample code:

CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(37.763778227711242, -122.32790567148118);
MBGeocoder *geocoder = [[MBGeocoder alloc] initWithAccessToken:<token>];
MBReverseGeocodeOptions *options = [[MBReverseGeocodeOptions alloc] initWithCoordinate:coordinate];
[geocoder geocodeWithOptions:options completionHandler:^(NSArray<MBGeocodedPlacemark *> * _Nullable placemarks, NSString * _Nullable attribution, NSError * _Nullable error) {
        
    NSLog(@"%@", [placemarks[0] addressDictionary]);
      
}];

Output:

{
    ISOCountryCode = US;
    country = "United States";
    formattedAddressLines =     (
        "United States"
    );
    name = California;
}

This makes it challenging to properly format and display reverse geocode data that is powered by a dynamic location at run time. If I reverse geocode a location that has a street address, it likely has a state field.

Below is the addressDictionary of a reverse geocode coordinate in downtown San Francisco. The state is now there. (37.794291209161685, -122.412848997168)

{
    ISOCountryCode = US;
    city = "San Francisco";
    country = "United States";
    formattedAddressLines =     (
        "1187 Washington Street",
        "San Francisco",
        "California 94108",
        "United States"
    );
    name = "Washington Street";
    postalCode = 94108;
    state = California;
    street = "Washington Street";
    subAdministrativeArea = "San Francisco";
    subLocality = "Nob Hill";
    subThoroughfare = 1187;
    thoroughfare = "Washington Street";
}

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 MBGeocoder 的 geocodeWithOptions:completionHandler: 流程以及報告中顯示的 MBGeocodedPlacemark addressDictionary 開始。比較 San Francisco Bay 和市中心的座標,然後驗證預期的 administrativeRegion/state 資訊是否始終暴露給反向地理編碼的 placemark。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
objective-c, swift
領域
api, mobile-dev
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。