#4 saga-wiki - dev


More / updated documentation on how to use the SAGA-API for developping Modules.


  • Volker Wichmann

    Volker Wichmann - 2011-01-13

    Please provide some more information on what you actually expect from this request. A complete programming tutorial, information on references to the SAGA API, information on how to program modules without compiling SAGA yourself etc. ?

    The complete API reference is available from the SAGA homepage, and the source code of SAGA should provide enough information on how to use it. There is a module library called "modules_lectures" which is used for educational purposes and which is a good starting point. In general, just copy the content of the "modules_template" folder and rename all occurrences of "template" within the file names and within the files themselves to your module name and start from this. Is this the information you are actually looking for?

    Best regards,

  • p68

    p68 - 2011-01-19

    Well, I have found the lectures and the other documentation and templates you are talking about. I must admit, that I am just starting with C++ and run in to difficulties quickly. I do understand how working on raster data works and how to implement own algorithms in modules. I've worked my way through the lectures and believe to understand most of it.

    One thing I tried to do was to convert line-shp files into a different (proprietary) file format. I need to convert information of individual lines from the attribute table and insert it into the binary file (in combination with the start-end coordinates of the lines). It's for a type of GPS navigation system. I couldn't find a way to take the attribute information for the individual lines and insert it into the right place in the binary file. I didn't want to start asking in the forum because my problem is probably due to my lack of experience with C++ programming and reading API documentations.

    Therefore, yes a tutorial covering all aspects of the api would of course be great. Something like the SAGA_2 users guide for programming. I'm aware that this would cost a lot of working time though.

    Looking at the WIKI Page "https://sourceforge.net/apps/trac/saga-gis/wiki/SAGA%20Development" gave me the impression, that someone already has the intention to write some more documentation...?

  • Volker Wichmann

    Volker Wichmann - 2011-01-22

    Reading the first and last point of a line as well as an attribute from the table should work like the following (untested):

    CSG_Shapes *pLines = Parameters("LINES")->asShapes();

    for(int iLine=0; iLine<pLines->Get_Count() && Set_Progress(iLine, pLines->Get_Count()); iLine++)
    CSG_Shape *pLine = pLines->Get_Shape(iLine);

    TSG_Point start = pLine->Get_Point(0, 0);
    TSG_Point end = pLine->Get_Point(pLine->Get_Point_Count()-1, pLine->Get_Part_Count()-1);

    int iField = 3; // read forth attribute column
    double myValue;

    myValue = pLine->Get_Table()->Get_Record(iLine)->asDouble(iField);

    I think for questions like these, it would be best to post to the SAGA development mailing list, see https://lists.sourceforge.net/lists/listinfo/saga-gis-developer

    BTW, by puttung the (unresolved) link on the wiki page I was hoping that someone else would be interested to start with such an tutorial - my time does not allow for that at the moment.


  • p68

    p68 - 2011-06-07

    This has been ages ago, but thanks - it works! Will post under the given link in the future...

  • Volker Wichmann

    Volker Wichmann - 2016-03-03
    • status: open --> closed
    • Group: --> v1.0_(example)

Log in to post a comment.