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

Support for MGLLineStyleLayer.linegradient to consider MGLfeature attributes #13342

@jumbopilot

Description

@jumbopilot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    archivedArchived because of inactivityfeatureiOSMapbox Maps SDK for iOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions