Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Most of the tutorials that I have seen are under Python and Linux. Is it Possible to create GRASS scripts in C# or atleast in Windows. I can create scripts using a different language as a compromise but at least it must run in C# because I am currently using C# for my GUI of the simulation system that I am making.

Thanks!

share|improve this question

2 Answers 2

Python is a cross-platform language, it runs on Windows as well as Linux. I think the closest you are going to get is writing a python script that performs the desired GRASS functions, and then call that script from C#. There are no .NET bindings for GRASS as far as I know.

share|improve this answer
    
So there is really no other way to go other than using python? –  teamAngat Feb 6 '11 at 14:07

This is an older one, but since it does not have an accepted answer:

GRASS GIS is divided into modules. Each module is a command line program which can by invoked in many ways. Inside GRASS itself, it is through the system command line or GUI (with our without auto-generated GUI dialog).

Most of the GRASS functionality is exposed through modules. There is some lower level functionality available through C or Python interfaces. This is usually used to create other modules.

Since the modules are command line programs, they can be invoked from (almost) any programming language. Usually people write scripts in Python but you can use also C/C++ or Java. See for example JGrassTools (https://code.google.com/p/jgrasstools/, http://moovida.github.io/jgrasstools/). I guess that the similar things apply will to C#.

Anyway, there are some convenient functions in GRASS Python API for module invocation which will be not accessible to you, so I would still consider combining with Python or switching to another language and framework if possible. Look for example to QGIS Processing or QGIS GRASS plugin how they solve the GRASS calls. You can of course have a look to GRASS itself. If open source license (GPL in these cases) is OK for you, you could save yourself some work with having the GIS-related things readily available.

In conclusion, I don't think that there ever will be any .NET binding for GRASS GIS. You can of course try to create one. But I personally don't have a desire to work on something which would be tight to some vendor and system specific platform. In any case, there are some ways available.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.