OSGeo / grass-addons

GRASS GIS Addons Repository
https://grass.osgeo.org/grass-stable/manuals/addons/
GNU General Public License v2.0
103 stars 154 forks source link

r.gwr missing from QGIS? #690

Closed nikosGeography closed 2 years ago

nikosGeography commented 2 years ago

I was searching for r.gwr in QGIS (v3.18 & v3.22) but I couldn't find it (same with GRASS GIS v7.8.6). I am using Windows 10, if that's relevant. Can you please help?

echoix commented 2 years ago

I'm pretty certain that all of the modules in this repo aren't in a default QGIS installation. All the modules here are addons, and aren't installed by default on GRASS.

echoix commented 2 years ago

If someone knows if there's a common, official way to add addons in QGIS, I'd like to hear. But at least I can help you to add it manually in your installation, with a dialog box and all.

I see you removed the issue template that contained some information I need to help you, like the platform you're using and it's version. Do you work on Windows?

veroandreo commented 2 years ago

Hello Nikos, QGIS Processing toolbox does not ship GRASS addons, only core modules. So, to use it, you need to launch GRASS and install the addon with g.extension r.gwr.

Dunno how to install GRASS addons in QGIS though. I darkly remember there was some discussion on that in the past. One possible way that I can think of is using GRASS plugin in QGIS, open a mapset, get the terminal and run the g.extension command above. Still, that requires to set an environmental variable for the addon to work within QGIS:

image

nikosGeography commented 2 years ago

Thank you all for your help. I am using Windows 10, GRASS GIS v7.8.6 and QGIS v3.18. As we speak I am trying to install the add-on in GRASS. In the picture attached, there are some boxes under "Options", should I check any of them? grass_extension_install

echoix commented 2 years ago

I already edited the options for a "core" module for QGIS. QGIS has some .txt description files that create the dialog boxes. In Windows, the description files are in C:\OSGeo4W\apps\qgis\python\plugins\grassprovider\description\. They are hand written for QGIS (some core modules don't have all the GRASS options to not scare off new users and help them homogenize the terminology between the software).

If having the addon installed in GRASS makes it possible for QGIS to find like any core module, then adding a description file should work. (Its clear that closing and reopening QGIS after installing the addon should be a good thing to do).

If we take for example the r.surf.idw.txt description file:

r.surf.idw
Surface interpolation utility for raster layers.
Raster (r.*)
QgsProcessingParameterRasterLayer|input|Name of input raster layer|None|False
QgsProcessingParameterNumber|npoints|Number of interpolation points|QgsProcessingParameterNumber.Integer|12|True|1|None
QgsProcessingParameterBoolean|-e|Output is the interpolation error|False
QgsProcessingParameterRasterDestination|output|Interpolated IDW

The first three lines are to identify the module:

The next lines are all the input and output parameters, one per line. Fields are separated by pipes (|) The number of fields change, for example per type of input:

The next are a little more variable:

There is a help file, but this file is not up to date though: https://github.com/qgis/QGIS/blob/master/python/plugins/grassprovider/grass7.txt

nikosGeography commented 2 years ago

Thank you @echoix for the detailed explanation. I managed to install the plugin as you can see in the image. There were some issues though.

  1. Although the plugin installed correctly, I received an error ERROR: Unable to read manual page: [Errno 2] No such file or directory: 'C:\\Users\\Geography\\AppData\\Roaming\\GRASS7\\addons\\docs\\html\\r.gwr.html' . I know that such directory doesn't exist. I found the the directory you mentioned above but mine is C:\Program Files\QGIS 3.22.2\apps\qgis\python\plugins\grassprovider\ex. But I can't find the r.gwr.txt description file.
  2. How can I see where GRASS stores the extensions (i.e. the file path in my laptop)? r_gwr_ dialog box
echoix commented 2 years ago

I see that the plugins installation folder is in C:\Users\Geography\AppData\Roaming\GRASS7\addons\ The description file effectively doesn't exist, I explained how to create it to show in QGIS for you. It is not needed at all to use in GRASS only.

It seems the Windows build failed: image https://wingrass.fsv.cvut.cz/grass78/x86_64/addons/grass-7.8.6/logs/r.gwr.log

Log file https://wingrass.fsv.cvut.cz/grass78/x86_64/addons/grass-7.8.6/logs/r.gwr.log ``` mkdir -p /c/Users/landamar/grass_packager/grass786/addons/r.gwr/bin mkdir -p /c/Users/landamar/grass_packager/grass786/addons/r.gwr/etc mkdir -p /c/Users/landamar/grass_packager/grass786/addons/r.gwr/docs/html mkdir -p /c/Users/landamar/grass_packager/grass786/addons/r.gwr/docs/man mkdir -p /c/Users/landamar/grass_packager/grass786/addons/r.gwr/docs/man/man1 test -d OBJ.x86_64-w64-mingw32 || mkdir -p OBJ.x86_64-w64-mingw32 x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/bufs.o -c bufs.c x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/estimate_bw.o -c estimate_bw.c x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/flag.o -c flag.c x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/gwr.o -c gwr.c x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/gwra.o -c gwra.c x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/main.o -c main.c x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/pavl.o -c pavl.c x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/rclist.o -c rclist.c x86_64-w64-mingw32-gcc -I/c/osgeo4w/include -g -O2 -I/c/osgeo4w/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -I/usr/src/grass786/dist.x86_64-w64-mingw32/include -DRELDIR=\"/c/msys64/usr/src/grass7-addons/src/raster/r.gwr\" -o OBJ.x86_64-w64-mingw32/weights.o -c weights.c make OBJ.x86_64-w64-mingw32/r.gwr.manifest.res && x86_64-w64-mingw32-gcc -L/usr/src/grass786/dist.x86_64-w64-mingw32/lib -L/usr/src/grass786/dist.x86_64-w64-mingw32/lib -Wl,--export-dynamic,--enable-runtime-pseudo-reloc -L/c/osgeo4w/lib -o /c/Users/landamar/grass_packager/grass786/addons/r.gwr/bin/r.gwr.exe OBJ.x86_64-w64-mingw32/bufs.o OBJ.x86_64-w64-mingw32/estimate_bw.o OBJ.x86_64-w64-mingw32/flag.o OBJ.x86_64-w64-mingw32/gwr.o OBJ.x86_64-w64-mingw32/gwra.o OBJ.x86_64-w64-mingw32/main.o OBJ.x86_64-w64-mingw32/pavl.o OBJ.x86_64-w64-mingw32/rclist.o OBJ.x86_64-w64-mingw32/weights.o /usr/src/grass786/dist.x86_64-w64-mingw32/lib/fmode.o OBJ.x86_64-w64-mingw32/r.gwr.manifest.res -lgrass_raster.7.8 -lgrass_segment.7.8 -lgrass_gis.7.8 -lintl -lgrass_gmath.7.8 make[1]: Entering directory '/c/msys64/usr/src/grass7-addons/src/raster/r.gwr' make[1]: Circular /c/msys64/usr/src/grass786/mswindows/generic.manifest.rc <- /c/msys64/usr/src/grass786/mswindows/generic.manifest.rc dependency dropped. sed -e 's/@CMD@/r.gwr/' \ -e 's/@VER_MAJOR@/7/' \ -e 's/@VER_MINOR@/8/' \ -e 's/@VER_RELEASE@/6/' \ /c/msys64/usr/src/grass786/mswindows/generic.manifest.rc > OBJ.x86_64-w64-mingw32/r.gwr.manifest.rc sed 's/@CMD@/r.gwr/' /c/msys64/usr/src/grass786/mswindows/generic.manifest > OBJ.x86_64-w64-mingw32/r.gwr.exe.manifest windres --input=OBJ.x86_64-w64-mingw32/r.gwr.manifest.rc --input-format=rc --output=OBJ.x86_64-w64-mingw32/r.gwr.manifest.res --output-format=coff -I/c/msys64/usr/src/grass786/mswindows rm OBJ.x86_64-w64-mingw32/r.gwr.exe.manifest OBJ.x86_64-w64-mingw32/r.gwr.manifest.rc make[1]: Leaving directory '/c/msys64/usr/src/grass7-addons/src/raster/r.gwr' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols? if [ "/c/Users/landamar/grass_packager/grass786/addons/r.gwr/bin/r.gwr.exe" != "" ] ; then GISRC=/usr/src/grass786/dist.x86_64-w64-mingw32/demolocation/.grassrc78 GISBASE=C:/msys64/usr/src/grass786/dist.x86_64-w64-mingw32 PATH="/usr/src/grass786/dist.x86_64-w64-mingw32/bin:/usr/src/grass786/dist.x86_64-w64-mingw32/bin:/usr/src/grass786/dist.x86_64-w64-mingw32/scripts:$PATH" PYTHONPATH="C:/msys64/usr/src/grass786/dist.x86_64-w64-mingw32/etc/python;C:/msys64/usr/src/grass786/dist.x86_64-w64-mingw32/gui/wxpython;$PYTHONPATH" PATH="/c/Users/landamar/grass_packager/grass786/addons/r.gwr/bin:/usr/src/grass786/dist.x86_64-w64-mingw32/bin:/usr/src/grass786/dist.x86_64-w64-mingw32/scripts:/usr/src/grass786/dist.x86_64-w64-mingw32/lib:/usr/src/grass786/dist.x86_64-w64-mingw32/lib:/C/OSGeo4W/apps/Python39/Scripts:/C/OSGeo4W/bin:/C/Windows/system32:/C/Windows:/C/Windows/system32/WBem:/usr/bin:/mingw64/bin/:/c/Users/landamar/grass_packager/grass78/addons/mswindows/osgeo4w/lib:/c/Users/landamar/grass_packager/grass78/addons/mswindows/osgeo4w:/c/windows32/system32:/c/windows:/c/windows32/system32:/c/windows:/c/msys64/usr/bin:/c/msys64/mingw64/bin" LC_ALL=C LANG=C LANGUAGE=C /c/Users/landamar/grass_packager/grass786/addons/r.gwr/bin/r.gwr.exe --html-description < /dev/null | grep -v '\|' > r.gwr.tmp.html ; fi C:/Users/landamar/grass_packager/grass786/addons/r.gwr/bin/r.gwr.exe: error while loading shared libraries: libgrass_raster.7.8.dll: cannot open shared object file: No such file or directory make: *** [/c/msys64/usr/src/grass786/include/Make/Html.make:14: r.gwr.tmp.html] Error 1 rm r.gwr.tmp.html ```

I found that the one in 7.8.dev built correctly, but since it is an addon written in C, and not Python, I do not recommend using this one as it could link to the bad library versions, thus not work at all. But you can copy and paste the docs folder from this zip to the same folder structure in C:\Users\Geography\AppData\Roaming\GRASS7\addons\docs no problem. https://wingrass.fsv.cvut.cz/grass78/x86_64/addons/grass-7.8.dev/r.gwr.zip

echoix commented 2 years ago

Are you able to use the plugin in GRASS though? You have the dialog box, but does it run on sample data?

wenzeslaus commented 2 years ago

Outside of the scope for this issue, but:

QGIS has some .txt description files that create the dialog boxes. ... They are hand written for QGIS

I think these should be generated by a tool automatically (which would help in these cases). These two GSoC projects tried to address the issue in different ways (the 2016 one only indirectly):

https://trac.osgeo.org/grass/wiki/GSoC/2016/PyQtGUI https://trac.osgeo.org/grass/wiki/GSoC/2018/IntegrationInQGIS3

(some core modules don't have all the GRASS options to not scare off new users and help them homogenize the terminology between the software).

Even this could be address in the GRASS modules themselves.

echoix commented 2 years ago

I think these should be generated by a tool automatically (which would help in these cases). These two GSoC projects tried to address the issue in different ways (the 2016 one only indirectly):

I tried to make sense of this on my own without knowing this during the holidays, since I didn't understand why QGIS missed so many options. It seems their old way of creating the dialog boxes were XML, but they stopped using this. They added the .txt files, no documentation or specs for grass and SAGA now, but it isn't the same format. Their core tools don't seem to use this method (.txt files)

nikosGeography commented 2 years ago

So I just finished with algorithm. It performs correctly (it generates raster maps of residuals, estimates etc). As I told you there is no path called C:\Users\Geography\AppData\Roaming\GRASS7\addons\docs in my laptop. Should I store the .zip file into C:\Program Files\QGIS 3.22.2\apps\qgis\python\plugins\grassprovider\ex (which is the directory for the extensions in GRASS)? Thank you very much for the help so far.

ninsbl commented 2 years ago

Can this be closed?

nikosGeography commented 2 years ago

Yes, I apologize for not doing it on time.