jblindsay / whitebox-tools

An advanced geospatial data analysis platform
https://www.whiteboxgeo.com/
MIT License
964 stars 160 forks source link

Feature Request for the manual: Interfacing with Rust #198

Open michelk opened 3 years ago

michelk commented 3 years ago

Just by looking at the manual, it seems like that it is discouraged to use the Rust-library directly? Is there any reason for that? If not, it would be helpful, if there were a section on that in the manual.

jblindsay commented 3 years ago

WhiteboxTools isn't really a library, but rather an application. Specifically, it is a command-line application. As such, it's not as though one could import the WBT source into another Rust project and call functions in the same way that you could a library. Now, that said, there are actually components of the project that are set up in that way. In particular, the whitebox-common, whitebox-lidar, whitebox-raster, and whitebox-vector libraries can be treated somewhat like a library, however, these are only for low-level operations (e.g. reading/writing various data formats) and do not include any of the tools themselves.

michelk commented 3 years ago

I would like to convert a TIN into a raster. Would you accept PRs, where I move some functionality out of the TINGridding::run-method to a location where it is accessible? What would be the preferred location? Could the library be uploaded to crates.io?

jblindsay commented 3 years ago

The logic creating the TIN is already contain in a library component (whitebox-common) found here:

https://github.com/jblindsay/whitebox-tools/blob/master/whitebox-common/src/algorithms/delaunay_triangulation.rs

michelk commented 3 years ago

I have an existing TIN and would like to convert that into a raster.

michelk commented 6 months ago

I would like to factor out parts of tin_gridding.hs into whitebox-common.

Background:

I have an existing triangulated surface-mesh with x,y,z nodes and would like to generate a raster, where the raster-values are interpolated from the z-value of the mesh-nodes.

Would you accept a PR for that?

jblindsay commented 6 months ago

Perhaps I'm confused about exactly what it is that you are asking here. The triangulate function that you are referring to is already contained within whitebox-common, within the algorithms section. It is already factored out of the tool TINGridding. That is, the tool just calls the function from white box-common.

michelk commented 6 months ago

Sorry for being unclear. I would like to factor out the gridding-part: I need a function which returns a raster from a set of triangles (e.g. tin_to_raster).