mapbox / mapbox/MapboxGeocoder.swift

Expected fields do not always appear in the MBGeocodedPlacemark

Offen
#167 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
Swift
Sterne
133
Forks
46
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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";
}

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit dem Ablauf von MBGeocoder's geocodeWithOptions:completionHandler: und dem im Bericht gezeigten MBGeocodedPlacemark addressDictionary. Vergleichen Sie die Koordinaten der San Francisco Bay und der Innenstadt und überprüfen Sie anschließend, dass die erwarteten administrativenRegion/state-Informationen für umgekehrt geokodierte placemarks konsistent bereitgestellt werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
objective-c, swift
Bereich
api, mobile-dev
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.