Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature properties not being used (wikidata) #171

Closed
diegogarciar opened this issue Dec 20, 2018 · 2 comments
Closed

Feature properties not being used (wikidata) #171

diegogarciar opened this issue Dec 20, 2018 · 2 comments

Comments

@diegogarciar
Copy link

diegogarciar commented Dec 20, 2018

The properties dictionary contained on the JSON feature is not being used while decoding the objects, specifically the wikidata field. The wikidata field is only decoded while decoding the superiorPlaceMarks as it is included on the main three.
Example (trimmed) JSON feature response

{          context = [{
                    id = "country.3124";
                    "short_code" = mx;
                    text = Mexico;
                    wikidata = Q96;
                }];
            id = "region.216972";
            "place_name" = "M\U00e9xico, Mexico";
            "place_type" =  [region];
            properties = {
                "short_code" = "MX-MEX";
                wikidata = Q82112;
            };
            relevance = 1;
            text = "M\U00e9xico";
            type = Feature;
}
if let rawIdentifier = try container.decodeIfPresent(String.self, forKey: .wikidataItemIdentifier) {
            let identifier = rawIdentifier.trimmingCharacters(in: .whitespacesAndNewlines)
            assert(identifier.hasPrefix("Q"))
            wikidata = identifier
        }

My temporal workaround will be to add wikidata variable to Property struct and do an elseif to populate original wikidata field

else if let wiki = properties?.wikidata{
            wikidata = wiki
        }
@1ec5
Copy link
Contributor

1ec5 commented Jan 23, 2019

@frederoni, this coding key should ensure that wikidataItemIdentifier gets set on the main placemark object, right?

case wikidataItemIdentifier = "wikidata"

@frederoni
Copy link
Contributor

frederoni commented Jan 25, 2019

this coding key should ensure that wikidataItemIdentifier gets set on the main placemark object

wikidataItemIdentifier should act as an alias to properties.wikidata which should parse wikidata.

possible fix in #177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants