Repository navigation
Add per-vertex multicolor polylines for geospatial data visualization - #2279
Draft
richyo-codes wants to merge 3 commits into
Draft
richyo-codes wants to merge 3 commits into
richyo-codes wants to merge 3 commits into
Conversation
Introduce MulticolorPolyline with per-vertex colors, border handling, and tests. Skip simplification and segmentation for multicolor polylines so gradients stay intact.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
MulticolorPolyline, enabling polylines to render different colors along their path, with smooth interpolation between colors assigned to individual vertices.Unlike existing
Polyline.gradientColors, this allows colors to represent measurements associated with individual geographic coordinates rather than applying a gradient across the overall line.Motivation and use cases
Many mapping applications associate measurements or other metadata with geographic coordinates. Visualizing these values directly along a route or path can provide useful context without requiring additional markers or overlays.
Potential applications include:
The API is independent of the underlying data, allowing applications to map any measurement to a color scale.
Implementation
MulticolorPolylineas a subclass ofPolyline, compatible with the existingPolylineLayer.vertexColors, with smooth interpolation between adjacent vertices.Canvas.drawLinefor individual segments.simplificationTolerance: 0when all original samples must be retained.Existing
Polylinebehavior remains unchanged.Example
The polyline example page demonstrates mapping GPS-associated speed measurements to a color scale and rendering the resulting per-vertex colors using
MulticolorPolyline.The same approach can be applied to any numeric or categorical data that can be represented as colors.
Testing and performance
Adds tests covering:
Includes synthetic benchmarks for 5,000- and 20,000-point paths, comparing ordinary polylines, uniform-color multicolor polylines, gradients, and outlined routes during pan and zoom.
The benchmarks measure CPU build/paint performance rather than GPU frame times or FPS.