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

Derive Placemark.scope from place_type #195

Open
1ec5 opened this issue Jun 26, 2019 · 0 comments
Open

Derive Placemark.scope from place_type #195

1ec5 opened this issue Jun 26, 2019 · 0 comments
Assignees
Labels

Comments

@1ec5
Copy link
Contributor

1ec5 commented Jun 26, 2019

Placemark.scope is computed by parsing the feature identifier, but this means a placemark can have only one scope. In fact, a Geocoding API result can have multiple scopes, but the remaining scopes are encoded in the place_type property.

@objc open var scope: PlacemarkScope {
let components = identifier.components(separatedBy: ".")
assert(components.count > 0)
return PlacemarkScope(descriptions: [components.prefix(2).joined(separator: ".")]) ?? PlacemarkScope(descriptions: [components.first!]) ?? []
}

/ref mapbox/mapbox-java#512
/cc @frederoni @samfader

@1ec5 1ec5 added the bug label Jun 26, 2019
@1ec5 1ec5 self-assigned this Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant