Comments

Thu Oct 13 06:33:38 2016 EDT

Hi,

We would like to use Grass GIS with our Asp.net web application to generate a layer with temperature data as gradient image.

Please help us out that how we can achieve this with our web application.

Thanks.

Fri Oct 14 09:51:18 2016 EDT

Hello,

As far as I know, there is no .NET binding for GRASS GIS currently, but it can be done because the core libraries and modules are mainly written in C. You can check this article to see how MinGW libraries can be invoked from .NET.

Let me understand your use case. You want to generate a temperature layer dynamically in the back end and serve the layer on your ASP.NET web application. Serving the layer can be done as an image or using MapServer. Generating the map can be done without actually binding the GRASS libraries to your .NET code. Remember that GRASS has modules as individual executable programs and also has its core libraries written in C. If you need functionalities of any modules, you have to call the external modules using, for example, System.Diagnostics.Process. If you need more low-level access to the core functions, you would have to use the MinGW binding technique introduced in the above article.

The most important part of all this effort is to initialize environment variables correctly so that GRASS modules and libraries think they’re within a proper GRASS session. You can see what environment variables have to be set in the startup Python script. Once those variables are set in your web application, you should be able to run GRASS modules as if they run inside a GRASS session.

I may be able to create a .NET example in the near future when I have free time.

Best Regards,
Huidae