This is in regard to this issue/a use case example where I’d really enjoy having this implemented: [FEATURE] Vectorized Span and Slope annotations · Issue #11015 · bokeh/bokeh · GitHub
See my showcase post: Geologic Cross Section Tool , it is under continuous development and am excited to roll out an updated version with some killer features… but…
One feature I would love to add is “line vector feature” functionality. So the most basic use case would be rivers (i.e. a multiline glyph) that are rendered in the plan view map. I would want them to show up as vertical spans when the user draws a cross section that intersects a line segment. I have the necessary JS functions dev’d to find the line intersections, but no ability to draw a a series of spans “in bulk” based on a columndatasource that’ll get constructed whenever the user adds a line to their cross section.
I’m considering attempting implementing an alternative using multiline but that will be likely fraught with peril, as I’d need to find the top of my layer elevations at that exact location (probably by doing additional line intersection calculations i.e. find where each vertical line intersects with the line demarcating ground surface on the section) to give the multiline the appropriate ys coords as well, which I’m worried might add some slowdown.
Any other options/ideas anyone can think of? Thanks!
I would probably try
segment with extents larger than the view area (possibly in conjunction with range bounds to limit zoom out). Another idea could be
BoxAnnotation with zero-width (only outline will show).
I ended up just going for it with multiline → the big enticement was that if successful (i.e. if I can do the line intersection with the top slice thing), it means I can do line intersections with the other layers as well, meaning I could programatically control which layers to span it across, which might serve some other special use cases that might come up in my day job. It actually worked out great and is not laggy/slow… at least for pretty simple line vector sets that i’ve tested on.
The way I calculated the ys field for the multiline on section (all done in JS) was as follows:
- Retrieve the ymin/ymax across the entire section, and use that for my starting ys for each line intersection.
- Run my line intersection routine with those segments to get the intersection point with the top slice.
- Since i know the full ymax/min already, use that to scale the vertical length appropriately. I used 10%, so basically the length of the length (how much it “sticks up” from the top slice) is 10% of the total thickness of the currently rendered cross section. I can adjust that to taste in the future if need be, or hell, even make it adjustable with a slider or something.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.