maps-plus icon indicating copy to clipboard operation
maps-plus copied to clipboard

pathColor is not per path segment

Open bowesmana opened this issue 7 months ago • 1 comments

I understood, perhaps wrongly, that pathColor would apply to a path segment, but it appears you can't have a different pathColor per path segment, e.g. this

| makeresults format=csv data="latitude,longitude,icon,layerGroup,markerColor
-33.7688,150.9063,person-booth,Alexander,blue
-27.6174,152.761,person-booth,Alexander,red
-38.1432,145.1228,person-booth,Alexander,red
-12.4634,130.8456,person-booth,Alexander,red"
| eval id=1
| streamstats c
| eval pathColor=if(c%2=0, "red", "green")
| eval icon=if(markerColor="red", "warning", icon)
| fields -  layerGroup
| eval tooltip=printf("icon=%s, markerColor=%s", icon, markerColor)

which seems to than take the first pathColor as the one for all path segments

Image

Maybe that's by design, as the event itself defines the point, not the path (4 points, 3 paths), but could use some clarification.

bowesmana avatar May 04 '26 08:05 bowesmana

Thanks for the detailed report and the great SPL example, @bowesmana!

Your intuition is correct — this is a limitation of the current implementation rather than intentional design. Right now, pathColor is applied to the entire path as a whole; the color from the first point in the path group is used for all segments, and per-row pathColor values on subsequent points are silently discarded during rendering.

The underlying data pipeline does actually capture the per-row pathColor value correctly — the gap is in how the path is drawn. Leaflet's polyline primitive takes a single color for the whole line, so supporting per-segment colors would require splitting each path into individual two-point polylines (one per segment) and styling each independently. The same change would need to apply across all rendering modes (regular polyline, ant-path, and the playback/GeoJSON branch).

I'm going to look into implementing this. I'll convert this to a feature request and track it here.

sghaskell avatar May 05 '26 18:05 sghaskell