Migrate pathfinding user guide off datashader#3558
Open
brendancol wants to merge 4 commits into
Open
Conversation
Build the line network with shapely LineStrings and burn it onto the grid with xrs.rasterize instead of datashader's Canvas. Render the network, paths, terrain, friction, and multi-stop route with matplotlib. Switch the unweighted/weighted path colors from red/green to orange/blue so the figures read for colorblind viewers. Closes #3460 Claude-Session: https://claude.ai/code/session_01TEXdRkRqYJKvATjquz26Pa
brendancol
commented
Jun 27, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: Migrate pathfinding user guide off datashader
Docs-only change: one notebook, no source code touched. I read the full notebook from the PR worktree and re-ran it.
Blockers (must fix before merge)
None.
Suggestions (should fix, not blocking)
None.
Nits (optional improvements)
- The path overlays are single-pixel lines on the 600x400 terrain (cells 17 and 22). The old code used
dynspread(..., max_px=2)to thicken them. The path is visible in the rendered figures but thin. If it reads too faint in the built docs, a small thickening or a thicker scatter would help. Not blocking.
What looks good
- The shapely segment list matches the original datashader xs/ys network exactly (checked the NaN-split segments against the original).
grid.xrs.rasterize(lines, column="value", fill=0)is the right call: on-line cells get 1, everything else stays 0, which is whata_star_search(..., barriers=[0])expects.- Red/green path colors swapped for orange/blue, and the prose cell that named the colors was updated to match.
import pandas as pdwas dropped since the datashader DataFrame construction is gone and nothing else used it.- The cost_distance and dask validation cells still print
Match: Trueafter the migration. - datashader stays in the
examplesextra (other notebooks still use it); the packaging removal is left to #3450.
Checklist
- Notebook runs top to bottom with no datashader import
- Line network matches the original data
- Replacement deps (geopandas, shapely, matplotlib) available in the docs CI extras
- No orphaned imports
- Colorblind-safe path colors
- Backend parity / numerical tests: N/A (docs-only, no source change)
- README feature matrix: N/A (no new function)
The single-pixel A* paths were hard to see on the terrain basemap once dynspread was gone. Add a small path_overlay helper that grows the path footprint by one pixel before plotting. Claude-Session: https://claude.ai/code/session_01TEXdRkRqYJKvATjquz26Pa
brendancol
commented
Jun 27, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
Follow-up review (after c9e6b68)
The one nit from the first pass is addressed.
- Added a
path_overlay(path, grow=1)helper in cell 17 that grows the path footprint by one 4-connected pixel and returns 1.0 on the path / NaN elsewhere. Cells 17 and 22 now plot through it, so the terrain routes read clearly on the basemap. - The helper is pure numpy (no new dependency) and preserves the path's dims and coords.
- Re-ran the notebook end to end: no datashader, and the cost_distance and dask validation cells still print
Match: True.
No remaining blockers, suggestions, or nits.
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
grid.xrs.rasterize(...)instead ofdatashader.Canvas().line()/.points().shade/stack/dynspread/set_backgroundand the datashader colormaps with matplotlib (plot.imshow,ListedColormap,Patchlegends).The notebook runs top to bottom with no datashader import. The
cost_distanceand dask validation cells both still reportMatch: True.Backend coverage
Docs-only change. No source code touched, so all four backends (numpy / cupy / dask+numpy / dask+cupy) are unaffected.
Test plan
jupyter nbconvert --executeruns the notebook top to bottom with no errorsCloses #3460
https://claude.ai/code/session_01TEXdRkRqYJKvATjquz26Pa