mapbox / mapbox/MapboxGeocoder.swift

Placeholder Attributes Not Correctly Set

Open
#159 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
133
Forks
46
PR merge metrics
No merged PRs in 30d

Description

Description

When making a forward Geocoding request, all the placemarks in the response should have their usual attributes (i.e. the attributes included in a vanilla cURL request to the Geocoding API). However, for some reason there are placemark attributes that are not being set.

Here's an example request:

        let options = ForwardGeocodeOptions(query: "Hong Kong")
        options.allowedScopes = [.place, .locality]
        options.maximumResultCount = 5
        geocodingDataTask = geocoder.geocode(options) { [unowned self] (placemarks, attribution, error) in
            if let error = error {
                NSLog("%@", error)
            } else if let placemarks = placemarks, !placemarks.isEmpty {
                for placemark in placemarks {
                    print(placemark.name)
                    print(placemark.code)
                    print(placemark.country?.code)
                    print(placemark.administrativeRegion?.address)
                }
            } else {
                self.resultsLabel.text = "No results"
            }
        }
Expected

In the Geocoding API playground, the result of a query with the same parameters includes "short_code" which should be the placemark.code value that is printed in the above code block.

screen shot 2018-09-18 at 2 40 42 pm

Actual

When the above code block is run, all but placemark.name return nil values:

Hong Kong
nil
nil
nil

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the ForwardGeocodeOptions and geocoder.geocode example for “Hong Kong,” then compare the returned placemarks with the Geocoding API playground response. Trace how the forward-geocoding response populates placemark.name, placemark.code, country.code, and administrativeRegion.address; done means those expected attributes are no longer nil.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.