# Creating GRASS.jl good or bad idea?

**URL:** https://discourse.julialang.org/t/creating-grass-jl-good-or-bad-idea/50495
**Category:** Geo
**Created:** [November 20, 2020, 1:50pm UTC](https://discourse.julialang.org/t/creating-grass-jl-good-or-bad-idea/50495 "2020-11-20T13:50:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![WhiteFenrir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/whitefenrir/32/19522_2.png) [@WhiteFenrir](https://discourse.julialang.org/u/WhiteFenrir)
#### Post date: [November 20, 2020, 1:50pm UTC](https://discourse.julialang.org/t/creating-grass-jl-good-or-bad-idea/50495/1 "2020-11-20T13:50:59Z")

</div>

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](https://grass.osgeo.org/grass78/manuals/r.to.vect.html)

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.

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [November 20, 2020, 5:32pm UTC](https://discourse.julialang.org/t/creating-grass-jl-good-or-bad-idea/50495/2 "2020-11-20T17:32:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![visr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/visr/32/17204_2.png) [@visr](https://discourse.julialang.org/u/visr)
#### Post date: [November 20, 2020, 7:00pm UTC](https://discourse.julialang.org/t/creating-grass-jl-good-or-bad-idea/50495/3 "2020-11-20T19:00:16Z")

</div>

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.

> [@joa-quim](#):
>
> 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).

I can’t say I’m familiar with GRASS internals. But I just read through [GRASS GIS APIs - GRASS-Wiki](https://grasswiki.osgeo.org/wiki/GRASS_GIS_APIs), 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](https://github.com/JuliaInterop/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](https://github.com/JuliaPackaging/Yggdrasil). Based on [Compile and Install - GRASS-Wiki](https://grasswiki.osgeo.org/wiki/Compile_and_Install) 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](https://github.com/JuliaBinaryWrappers/GDAL_jll.jl). 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](https://github.com/JuliaPackaging/BinaryBuilder.jl), which is used to create the binaries.

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [November 20, 2020, 7:25pm UTC](https://discourse.julialang.org/t/creating-grass-jl-good-or-bad-idea/50495/4 "2020-11-20T19:25:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![WhiteFenrir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/whitefenrir/32/19522_2.png) [@WhiteFenrir](https://discourse.julialang.org/u/WhiteFenrir)
#### Post date: [November 23, 2020, 2:28pm UTC](https://discourse.julialang.org/t/creating-grass-jl-good-or-bad-idea/50495/5 "2020-11-23T14:28:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![visr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/visr/32/17204_2.png) [@visr](https://discourse.julialang.org/u/visr)
#### Post date: [November 23, 2020, 4:05pm UTC](https://discourse.julialang.org/t/creating-grass-jl-good-or-bad-idea/50495/6 "2020-11-23T16:05:12Z")

</div>

Cool, let us know if you need any help!
