Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Support for MGLLineStyleLayer.linegradient to consider MGLfeature attributes #13342

Closed
jumbopilot opened this issue Nov 10, 2018 · 2 comments
Closed
Labels
archived Archived because of inactivity feature iOS Mapbox Maps SDK for iOS

Comments

@jumbopilot
Copy link

jumbopilot commented Nov 10, 2018

Steps to reproduce

Currently, Mapbox seems to support only style layer properties determined by properties on the feature itself or, alternatively, from a computed variable such as $zoomLevel or $lineProgress. geojson-vt is responsible for varying $lineProgress along the path of the line feature. Beyond that one variable, there isn’t a general mechanism for integrating external data that varies along the path of the line.

Here's a simple use case.

  1. Create a MGLPolylineFeature layer
let polyline = MGLPolylineFeature(coordinates: &coordinates, count: UInt(coordinates.count))
self.polylineTrackSource = MGLShapeSource(identifier: "my-identifier", features: [polyline], options: [MGLShapeSourceOption.lineDistanceMetrics : true])
style.addSource(self.polylineTrackSource)
  1. Create a MGLFeature with attributes for above layer
let feature = MGLPointFeature()
feature.coordinate = location.coordinate       
feature.attributes["elevation"] = location.altitude
  1. Style MGLLineStyleLayer.linegradient

layer.lineGradient = NSExpression(format: "mgl_interpolate:withCurveType:parameters:stops:(elevation, 'linear', nil, %@)", [0: UIColor.blue, 10000: UIColor.red])

Expected behavior

Styling of MGLLineStyleLayer.linegradient based on feature attributes is supported.
The MGLLineStyleLayer.linegradient property does support applying interpolation or step functions to feature attributes.

Actual behavior

Styling of MGLLineStyleLayer.linegradient based on feature attributes (e.g. elevation) is not supported.
The MGLLineStyleLayer.linegradient property does not support applying interpolation or step functions to feature attributes.

Configuration

Mapbox SDK versions:
v4.6.0
iOS/macOS versions:
v12.x
Device/simulator models:
iPhone 7++
Xcode version:
V10, Swift 4

@asheemmamoowala asheemmamoowala added the iOS Mapbox Maps SDK for iOS label Nov 12, 2018
@stale stale bot added the archived Archived because of inactivity label Jul 27, 2019
@stale
Copy link

stale bot commented Jul 28, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Jul 28, 2019
@jumbopilot
Copy link
Author

jumbopilot commented Oct 12, 2019

Can this be addressed in conjunction with Issue232?

Do I need to create a new (linked) issue or can this one be reopened?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity feature iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

3 participants