How would I plot borehole traces in 3d?

2019-07-02 01:10发布

问题:

Borehole data contains the "collar" information: that's X,Y, and Z (Z is ground elevation, and Z=0 is some datum like mean sea level), and also borehole length in Z direction.

How can I create a 3D plot of the borehole traces (curves)? I'm looking for solutions in R but also interested in python (though haven't tagged it as such in case it just confuses).

The result might be similar to this image from ArcScene:

.

Here, the borehole traces are coloured by another parameter from one or more separate files, and keyed to the borehole name or some index. (This viewer also allows rotation of the viewport with mouse.)

Boreholes might also be non-vertical, and not straight.

Here are some data:

> dput(collars)
structure(list(boreid = c(47063L, 47311L, 49511L, 52752L, 58935L, 
58937L, 65763L, 67441L, 67442L, 77351L, 77436L, 77945L, 84156L, 
89809L, 90138L, 95482L, 96560L, 103583L, 104536L, 105222L, 105483L, 
105548L, 110720L, 180221L, 301001L, 302293L, 306496L, 306497L, 
325725L, 326668L, 327068L, 333303L, 333332L, 333927L, 374749L, 
374946L, 376243L, 376244L, 958884L, 958898L, 959394L, 965482L
), easting = c(554952L, 492126L, 537529L, 499972L, 490997L, 487258L, 
555368L, 496144L, 493860L, 451445L, 452195L, 525050L, 439191L, 
485774L, 519132L, 491804L, 459810L, 476288L, 499113L, 474318L, 
513550L, 501624L, 484463L, 489155L, 558105L, 532973L, 531296L, 
531852L, 532313L, 485727L, 540972L, 478073L, 517917L, 429608L, 
467779L, 469052L, 471671L, 457678L, 511513L, 402157L, 461493L, 
511070L), northing = c(5804714L, 5730703L, 5787590L, 5797164L, 
5782344L, 5786531L, 5797011L, 5775664L, 5776207L, 5773871L, 5771346L, 
5793440L, 5771468L, 5776930L, 5781414L, 5794889L, 5773111L, 5782370L, 
5734834L, 5732385L, 5758450L, 5781360L, 5745034L, 5769765L, 5800168L, 
5778723L, 5766709L, 5772101L, 5808899L, 5723574L, 5785123L, 5731540L, 
5761725L, 5774060L, 5774283L, 5774569L, 5779113L, 5777001L, 5773012L, 
5767950L, 5766123L, 5753167L), elevation = c(32.68, 10.4, 2, 
33.41, 16.8, 22.34, 3.64, 33.7, 12.3, 39, 45.6, 32.94, 168.2, 
13.6, 0.9, 27, 34, 21.05, 4.2, 20.7, 28.17, 20.5, 80, 160.1, 
20.7, 0.6, 8.5, 1.5, 68.6, 4.6, 5.5, 18.15, 23.5, 56.3, 27.4, 
31.6, 24.5, 36.7, 78.09, 125, 96.89, 26.75), total_depth = c(619.25, 
1773, 1238, 496.83, 900.02, 872.36, 1031.75, 1181.11, 1155, 528.8, 
775, 875.75, 249.94, 903.29, 1049.8, 178, 840.23, 727.67, 1586.47, 
353.9, 1389.2, 905, 333, 327, 1294, 3661, 2290, 1862, 1197, 1422, 
1400, 840, 1524, 221.1, 825, 849.4, 742.6, 607, 2345, 2001.8, 
1443, 2493.5)), .Names = c("boreid", "easting", "northing", "elevation", 
"total_depth"), class = "data.frame", row.names = c(NA, -42L))

回答1:

A good option to do this is the RGL package. This allows you to draw 3d images such as these (linked from this question):

A good place to get some inspiration for rgl is to have a look at the questions about it here on SO.

Another option would be the scatterplot3d package (image linked from here, link includes example code):

Carefully reading the documentation of these packages, and looking up some online examples should get you started.