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

Route duration annotation styling should use Expressions, not JSON #2996

Closed
1ec5 opened this issue May 12, 2021 · 3 comments · Fixed by #3177
Closed

Route duration annotation styling should use Expressions, not JSON #2996

1ec5 opened this issue May 12, 2021 · 3 comments · Fixed by #3177
Assignees
Labels
op-ex Refactoring, Tech Debt or any other operational excellence work.
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented May 12, 2021

#2873 implemented runtime styling of route duration annotations by hard-coding JSON-formatted strings, deserializing them as JSON-formatted dictionaries, and using a private map SDK API to pass these raw dictionaries into the style. Instead, we should initialize the map SDK’s type-safe Expression type, which is analogous to NSExpression in map SDK v6.x but more consistent with the style specification.

let symbolSortKeyString =
"""
["get", "sortOrder"]
"""
if let expressionData = symbolSortKeyString.data(using: .utf8), let expJSONObject = try? JSONSerialization.jsonObject(with: expressionData, options: []) {
mapView.mapboxMap.__map.setStyleLayerPropertyForLayerId(NavigationMapView.routeDurationAnnotationsLayerIdentifier,
property: "symbol-sort-key",
value: expJSONObject)
}

/cc @mapbox/navigation-ios @avi-c

@1ec5 1ec5 added the op-ex Refactoring, Tech Debt or any other operational excellence work. label May 12, 2021
@1ec5 1ec5 added this to the v2.0.0 (GA) milestone May 12, 2021
@avi-c
Copy link
Contributor

avi-c commented May 12, 2021

Agree completely. The issue is that currently there are some properties, such as 'symbol-sort-key', 'icon-anchor', 'text-anchor' and a few more where the iOS expression implementation doesn't support data driven styling, only some fixed constant values that it provides.

Once that is addressed then we should remove any use of private styling in favor of the suggested and officially supported methods.

@zugaldia
Copy link
Member

The issue is that currently there are some properties, such as 'symbol-sort-key', 'icon-anchor', 'text-anchor' and a few more where the iOS expression implementation doesn't support data driven styling, only some fixed constant values that it provides.

Is there a Maps SDK ticket tracking this work?

@1ec5
Copy link
Contributor Author

1ec5 commented May 14, 2021

The issue is that currently there are some properties, such as 'symbol-sort-key', 'icon-anchor', 'text-anchor' and a few more where the iOS expression implementation doesn't support data driven styling, only some fixed constant values that it provides.

That was mapbox/mapbox-maps-ios#172, which was fixed by mapbox/mapbox-maps-ios#185 in v10.0.0-beta.16. This issue is unblocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
op-ex Refactoring, Tech Debt or any other operational excellence work.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants