Skip to content

Derive Placemark.scope from place_type #195

Description

@1ec5

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions