GRASS Development APIs

Video in TIB AV-Portal: GRASS Development APIs

Formal Metadata

GRASS Development APIs
Lifting the fog on the different ways to develop for GRASS
Alternative Title
Geospatial - Grass Apis
Title of Series
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Release Date
Production Year

Content Metadata

Subject Area
Standard deviation Scripting language System call Multiplication sign Source code Thermal expansion Database Water vapor Grass (card game) Function (mathematics) Open set Data dictionary Mereology Area Formal language Mathematics Type theory Radio-frequency identification Different (Kate Ryan album) Semiconductor memory Information Endliche Modelltheorie Series (mathematics) Library (computing) Descriptive statistics Stability theory Physical system Exception handling Scripting language Area Presentation of a group Electric generator Differential (mechanical device) Mapping Wrapper (data mining) File format Software developer Point (geometry) Parameter (computer programming) Streaming media Thermal expansion Type theory Category of being Latent heat Oval Chain output Modul <Datentyp> Parametrische Erregung Physical system Reading (process) Spacetime Point (geometry) Metre Dataflow Functional (mathematics) Module (mathematics) Computer file Software developer Line (geometry) Disintegration Cellular automaton Streaming media Discrete element method Crash (computing) Aeroelasticity Read-only memory Computer programming String (computer science) Gastropod shell Speicherbereinigung Software testing output Implementation Module (mathematics) Data dictionary Beer stein Graph (mathematics) Interface (computing) Graph (mathematics) Projective plane Denial-of-service attack Database Line (geometry) Thresholding (image processing) Grass (card game) Cartesian coordinate system System call Database normalization Radius Personal digital assistant Function (mathematics) Computer programming Gastropod shell Library (computing) Speicherbereinigung
Keyboard shortcut System call Scripting language Code Differential (mechanical device) Combinational logic Set (mathematics) Grass (card game) Function (mathematics) Mereology Usability Geometry Different (Kate Ryan album) Object (grammar) Flag Information Endliche Modelltheorie Series (mathematics) Library (computing) Social class Scripting language Overlay-Netz Area Programming paradigm Touchscreen Mapping Point (geometry) Keyboard shortcut Electronic mailing list Bit Open set Type theory Vector space Raster graphics Permanent Order (biology) Modul <Datentyp> Energy level Quicksort Parametrische Erregung Spacetime Point (geometry) Asynchronous Transfer Mode Functional (mathematics) Module (mathematics) Divisor Line (geometry) Directory service Element (mathematics) Wave packet Pi Googol Computer programming Energy level Task (computing) Identical particles Module (mathematics) Graph (mathematics) Information Projective plane Code Grass (card game) System call Uniform resource locator Function (mathematics) Computer programming Speech synthesis Object (grammar) Library (computing)
Satellite Standard deviation Greatest element Scripting language User interface Code File format Numbering scheme Database Grass (card game) Mereology Variable (mathematics) Usability Data management Type theory Different (Kate Ryan album) Velocity Vector space Process (computing) Series (mathematics) Library (computing) Fundamental theorem of algebra Scripting language Programming language Programming paradigm Mapping Cross-platform Software developer Point (geometry) Mereology Numbering scheme Demoscene Type theory Process (computing) Frequency Sample (statistics) Vector space Raster graphics Data structure Point (geometry) Web page Functional (mathematics) Line (geometry) Discrete element method Element (mathematics) Frequency Term (mathematics) Operator (mathematics) Computer programming Energy level Integrated development environment Data structure output Mathematical optimization Data type User interface Operations research Addition Standard deviation Interactive television Computer network Usability Core dump Grass (card game) Graphical user interface Software Integrated development environment Function (mathematics) String (computer science) Calculation Video game Mathematical optimization Window Library (computing)
Googol Mass Grass (card game) Information Grass (card game)
so grass basically is a C project Our redundancy as Marcus said it's over 30 years of development and it's quite interesting that actually a lot of the the basic C function that we developed over the years ago is still there are still working that's a quite stable source space and you know it has change a lot over time very early on shell scripts were integrated into the grass or space and we used as a way to kind of glued together different parts of grass to 2 to for some task but we've had over the time appearance of new generations of developers use to coding in different languages and we have the arrival of new languages as well and so now we have different the Application Programming Interfaces to grasp and the aim of this president's can give you a quick overview of these different eyes that you have a notion of of what you can do with grass how you can program with France so I should the 1st thing I'm the say that grass in itself isn't it yeah grass was built up following the Unix philosophy on the kiss principle each grass individual mood model does 1 thing does it well and has defined parametres markers just showed you how you can look at them in different ways including as WPS uh XML descriptions but so each module can almost be c seen as a function that you can then chained together to build your own applications when you create outputs from uh as a matter from uh grass module it is automatically stored In the this category is the graph database war as TIFF files as or whatever format you want to but normally in there are so many in the grass database and other types of outputs from models can be stored in files or you can actually type them through the standard uh into expanded output flows that from 1 model to another so just chaining these models can be considered the writing a program and use a very simple a very simplistic as well program saying let's test it the any of our points fall into it's a very rough the design flood risk areas and you have the chaining of a series of of commands that measure taken elevation model that is made out of that were streams our most probable probably to be a were water accumulation is going to most important transform that director buffet and then check which of our points In this case we using capping around fall into a 500 meter radius around these streams so yeah you can really easily change press commands and a lot of the cross commands really aligned to work a very basic functions and so you can train those and right your own programs in a certain way just by the that when you do that all the memory handling and garbage collection of you want it is handled by the system is each model is an eponymous program so once the mothers over everything is just read after them by the system error handling is done by each model so grasses such as not as a standalone or not among those monolithic application so when you have a model that crashes that only the model because you can have a whole program the crashes and actually can call graphs and the models through any language that can be called the system calls on you see 2 examples of Python and C if you want you can integrate calls to python models within an application that you right within the uh program in any language but so this is 1 way to programme in for grass it has some as the disadvantages obviously that you sometimes using the system calls you need to really be uh informed about how to handle still expansion and it's not always easy to handle the output of the models when they're not maps here we already have to know how to do that in your respect to programming languages the and so a Python scripting my library was developed to use let's say the system calls to grass models these are essentially and the entire library built around subprocess be open from within Python and generally almost all the different functions of the longer added wrappers around them and you have specific functions to handle different types of input output you can read output line by line you can put it out as dictionaries or you can actually work through the standard flows as some examples here so you have if you want to the basic system call run command this collar command and then it puts out to standard output whatever if without but you can do the same and get out a string separated line-by-line line and treat for example expects lines whatever function to use in in in Python to that or you can put out a Python dictionary so you have these different functions in the grass scripting library that allow you to call graphs commands in different ways and to have different types of outputs this makes
the call to grasp models really easy landfill make that easier fact she developed Python scripts around there's a series of other rappers that you can use but which have been built kind of 4 4 as as good if you wanted to allow easier calls to some some path that often needed within grasp so for example creation of a new grass project location or a listing for example whatever vector maps you have in your in your maps said at such all the scripts that are part of the grass or if they met the the shelf that have been rewritten to this new Python library In grass said and as Marcus said if you use the grass model of the graphical model or you can actually program graphically a script which will then use this by Python scripting library space no the Python
scripting library that just pretend it is very easy to use for very basic scripting but it had does have some so let's say disadvantages it does not give you know level access to graft area functions for data you only get access to the graph models and in some way it's not a very Pythonic way of of of programming when you use the Python script language it's a very simple scripting approach and it does not really encourage the user to choose to really work within the the Pythons paradigm so as part of a Google Summer of Code project um the new library was developed called high which has 2 layers to it if you want the 1st layer can be seen as a sort of a replacement over the Ivan Brass scripting library which thus functions to call it graph model and the 2nd allows a lower level access to the greatest jails 89 the see types of Python library this allows to integrate let's say both python programming philosophy with the graph of the that's a much closer so as an example here you have the access to to models of this 1st layer spoke about so you can create objects out of France model called and then handle them in classical object-oriented ways you can set flags or or or parametres on the way and then call your the model that way you can also actually create shortcuts python shortcut calls which then really make your Python code almost look like code you call but the region module exactly with the mangy region or the the info nothing as nothing the that is a way to allow people also to 2 it's a use Python scripting but still stay within the known realm of grass module costs so interesting difference to the to scripting library is the fact that models are treated as objects and then the play around with them in that same or performing way however output handling is not as easy as it just takes the output and the standard output from uh and from the modules and so you already have to know a bit more about how to handle that In order to be able to use that currently the 2 libraries coexist and in a very let's say very subjective my personal simplify differentiation of the 2 I would say the 1st 1 is a very that's a grass dis user-oriented library which allows them to start scripting where the 2nd is the baby may be a bit more Python oriented which allows people who like Python to use grass in a more sophisticated way the 2nd layer of the pie library allows a much lower level access to the the grass functions and grass status it uses types to access the the grass PPI n it kind of combines the ease of Python programming with the performance of the grassy EPI so you can actually really get the great performance of markers which is what's the speaking about through Python accessing the actual of C libraries this different packages but notably Rasta vector and general GAS that the coming in and and more more generic tasks just a very quick example here you have an example of of dealing with the victim out to point map which you can just open and then here 1st class is just look at how many points do we have we then create a new point which we can then add to the map so very easily to actually add new elements to months in the following way but you also lacks for example you can iterate over to match geometric features within within the and you have access to specific function that buffering such as overlays etc. we then use the actual the very grass functions behind the screens to to then apply this function so again the difference between the 2 Python API is is 1 is really that's a a scripting allowing people to train grasp command very easily the 2nd is more of a Python factors to grasp tha
finally for those you who really want to go down into the code there's obviously the scene API which has known over 30 years of development parts have remained as I've already said extremely stable over the period of life interesting to see with what quality the the the initial functions are often programs the and but this has been tons and tons and thousand of additions on the way out selected a few of them to highlight how things evolve so you had the interaction of floating point and all supporting grass 5 the whole new vector library including the network tools and marker show terms In grass 6 and the whole performance optimization March 5 support and much but across cross-platform you usability in grass fix anything now by press and we can really say that the Windows for the process then light as well so much more than than might have in the past this streaming calling libraries again the general fundamental operations this level you have the rest and the vector libraries but this many many other libraries I'm not list them all here but you can use specific mathematical calculations you have tremendous satellite imagery displaying maps etc. etc. is a consistent naming scheme across the libraries and which really allows you to very quickly identify from the library within this whole grass seed this year in PI the functions come from there is obviously a host of different that the structures that are are really specific to to grasp uh and and use needs uh and so you can have a look at programming model to have really details obviously of this the C API but just some ideas of what that looks like you know 1 hint treating vector vector map and they're going through it point by more points for example or in the bottom here the fact of going through president data quite interesting the discussion about the the fact that be doesn't allow role based access to to the grass actually larger different types of actors to rest of the the rule-based or segment-based such and so this is allows great flexibility also in terms of how you want acts and how you want to do with with velocity just as a final note grass allows very easy user Interface creation you just define the different elements that you need in user interface and you get both command line interface and a graphical interface automatically the back out of the final notes all the examples are shown
of running from different programming language you have to be within that saying environment set up for grass usage see the you lost a start up script or you can do that manually and grass also encourages people to reuse a series of coding standards and these are all listed here in the semantic page so that was it and enjoy
grass 7