mapbox / mapbox/MapboxGeocoder.swift
Expected fields do not always appear in the MBGeocodedPlacemark
还没有人认领这个 Issue。
- 主要语言
- 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";
}
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 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