I'm using the LecoS software: https://github.com/Martin-Jung/LecoS

I've clipped my raster to reduce processing time to focus in on the areas I'm interested in. The entire raster has 11 classes, but if I clip the raster some of the classes also get clipped. I learned to look at the histogram of the different classes for each clip. If a class is missing, then I select "no" under the classification settings. My reason for retaining the entry in my batch option is that there is no way to delete individual rows - deleting removes rows from the base. However, there are some cases where the software runs into issues for some classes using particular metrics. For example, Euclidean Nearest-Neighbor Distance runs into problems for some classes and this has to do with the way that it is calculated, but there is no way to know this from the onset.

Screenshot of 11 classified raster (water, mining, burnt, deciduous, etc.) and sample buffer vector overlay.

My batch processing involves 144 line items. It is painful. The batch processing window has an option to save the entries, but it defaults back to the drop-down menu options. For example, if a processing error occurs I have to re-open and it defaults back to Raster Classified: "Yes", Metrics (single class): "Landcover", and Load in GIS: "Yes". This means that I have click back through each drop-down item 144X for each column to align with options. It took me a long-time to individually enter the baseline options, but it was faster than doing the analysis over and over again. It is a process of discovery in the analysis on what items will not compute (e.g., a Euclidean metric for Agriculture 500 m buffer overlay - raster cell class 8 freezes in one of my smaller clips, but not others and the 1000 m buffer overlay works just fine). I have to note where it freezes - select that item out - then start over again.

Screen shot of LecoS batch processing with over 140 analysis options

I am wondering if there is an easier way to do this - I'm sure there is. I was hoping that someone might be able to direct me to a means to enter into the "back-door" using Python code. I don't know Python very well - but I'm reasonable with r-stats and a few other languages. This batch process is so clunky - it also saves each metric into separate files that I have to piece back together using r-stats script. It would also be nice if I could run a complete analysis including max, min, sd, eveness, etc. of the metrics, but this adds yet another layer of complexity in clicking dropdown menus and having to later re-integrate the separate csv files. Hoping someone could direct me to a scripting option for this type of analysis. I'm willing to learn the Python basics, but hoping someone could get me started. Is this a common issue with batch processing analysis in QGIS?

1 Answer 1


I found a partial solution! The thought occurred to me to open the *.json file in notepad. The information in the file is straightforward:

          "OUTPUT_FILE": "C:/Users/mthompson/Documents/2018/AT/18398-055 AVC Program/Maps/QGIS/LecoS/Euclidean/Hwy2 SH Water 1km.csv"
          "PARAMETERS": {
                         "LMETRIC": "0",
                         "LAND_GRID": "\"ABMIw2wCV_Hwy2SH\"",
                         "IS_CLASS": "True",
                         "ADDTABLE": "False",
                         "LC_CLASS": "1",
                         "CMETRIC": "Euclidean Nearest-Neighbor Distance",
                         "VECTOR_GRID": "\"Hwy 2 Sandy Hills 1km\""
   },...and so on...

I was able to find and replace "CMETRIC" =, which in the saved version had a # rather than text. I replaced the parameter option with the text of the metric in the dropdown menu (in this example = "Euclidean Nearest-Neighbor Distance", and this worked! It now loads the option that is typed into that parameter option - this saves time! The "IS_CLASS": "True" is also incorrect in the default - I changed "True" to "Yes" and "False" to "No" and now it loads properly.

However, I've tried adding a final parameter option for "Load in QGIS" drop-down option. This does not appear in the saved *.json file that I have. So far I've tried:

"LOAD_GIS": "No" "LOADGIS": "No" "LOAD_GIS": "False" "LOADGIS": "False"

No success.

  • I found this option for filling in the "No" values , but the solution to CMETRIC is unique this question for the LecoS plugin. Aug 16, 2018 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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