Creating GRASS.jl good or bad idea?

Dear all,

I start working with Julia and I feel a lack of integrated GIS package. I can find many packages that sometimes need to be used together to have a full workflow. That is great but the GeoJulia ecosystem still miss of an integrated package with precoded functions such as the ones we can find in QGIS or GRASS. I would like to help the community but as I am a beginner with Julia I would like our opinion first and maybe some tips.

First, do you thing a wrapper for GRASS GIS could be interesting ? Here an example of function from the GRASS GIS Documentation: r.to.vect - GRASS GIS manual

Second, if the answer is yes to the previous question, do you have guide, tutorial, tips to create this wrapper ? I never wrap C function to Julia or any other language, so it is an unknown world for me.

Thank you for your reading.

3 Likes

Hi, regardless of the interest, I’m afraid wrapping GRASS is not even doable because, AFAIK, GRASS is not a library and so it has no mechanism to make the data I/O visible to Julia’s ccall mechanism (the one used to interface with external libraries).

But note that between GMT.jl & GDAL.jl you already have available a lot of the operations used in GIS, but not things like the skeletilization + vectorization that you linked to.

I think it’d be a good idea! I occasionally use GRASS functions from the QGIS Processing Toolbox, but a GRASS.jl would be a great addition to the JuliaGeo ecosystem.

I can’t say I’m familiar with GRASS internals. But I just read through GRASS GIS APIs - GRASS-Wiki, and I don’t think this view is complete. Indeed much of the interface is focused around small applications that follow a Unix philosophy. But further on in the linked article they discuss pygrass, rgrass and the C-API. I don’t see why we couldn’t wrap the C-API with Clang.jl, to produce a library similar to Python and R.

Besides starting on the wrapper, I think a good first step may to try to get a GRASS build in Yggdrasil. Based on Compile and Install - GRASS-Wiki the main dependencies are GDAL and PROJ, which are both already available in Yggdrasil. If we have this, we would get a auto generated GRASS_jll, similar to GDAL_jll. With this, Julia users would have a reliable cross platform way to access both the GRASS applications and libraries. It really depends on the library, and if it supports cross compilation, how much work this is. But you could look into BinaryBuilder, which is used to create the binaries.

2 Likes

Thanks. I didn’t know about the GRASS C-API

Thank you for all the information. I will try to do something.

1 Like

Cool, let us know if you need any help!