Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-15 Thread Nikos Alexandris

Here a working solution (as explained/provided by Stefan) for the
"Processing Toolbox". Note, below "grass-ltr" maybe any grass 7.x
version, like grass-7.4.svn


1. Copy a GRASS GIS addon, say `r.example` under
```
C:\OSGeo4W64\apps\grass\grass-ltr\scripts\
```

2. Copy a Windows Batch file named after the addon, of course with the
extension of the file being `.bat` under
```
C:\OSGeo4W64\apps\grass\grass-7.4.svn\bin\ # r.estimap.bat
```
whose content should be:
```
@"%GRASS_PYTHON%" "%GISBASE%/scripts/.py" %*
```

3. For the description of the UI, copy `r.example.txt` under
```
C:\OSGeo4W64\apps\qgis\python\plugins\processing\algs\grass7\description\
```

The above steps will make the addon listed under the list of GRASS GIS
algorithms, inside the Processing toolbox.


4. There is another thing (yet to test): perhaps a file name r_example.py
is required under

in C:\OSGeo4W64\apps\qgis\python\plugins\processing\algs\grass7\ext

Looking at existing files there-in, they are not the "same" and I guess
it's going to be required (to understand what and how) in order to get
an addon running as expected.

Nikos


signature.asc
Description: PGP signature
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-15 Thread Nikos Alexandris

* Helmut Kudrnovsky  [2018-10-12 12:25:47 -0700]:




How do we compile and package a single GRASS GIS Addon >binary to proceed
with testing under Windows?


see

https://wingrass.fsv.cvut.cz/grass77/x86_64/addons/grass-7.7.svn/

for the precompiled wingrass addons.

have a look into one of the zip File how the structure looks like.


Thank you Helmut.


(@Martin) Is the process that generates these "pre-compiled" addons accessible?

Nikos




signature.asc
Description: PGP signature
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-12 Thread Helmut Kudrnovsky

>How do we compile and package a single GRASS GIS Addon >binary to proceed 
>with testing under Windows? 

see

https://wingrass.fsv.cvut.cz/grass77/x86_64/addons/grass-7.7.svn/

for the precompiled wingrass addons.

have a look into one of the zip File how the structure looks like.





-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-12 Thread Nikos Alexandris

* Stefan Blumentrath  [2018-10-12 09:00:07 +]:


Dear Nikos and others,

First of all, we have to clarify if you: a) want a solution that does
not require a GRASS database (meaning a Processing like approach) or b)
if an existing GRASS database is acceptable as a requirement to run
your addon

If the answer is a), the Situation (in QGIS 3) regarding GRASS
integration in QGIS is indeed far from ideal.  In order to change that,
a bigger effort seems necessary (as envisioned in the GSoC).

As a workaround for a) you could write a Processing Python script as a
wrapper that uses the grass --exec functionality with a temporary GRASS
DB and: 1) installs the addon if it does not exist 2) takes QGIS layers
(and additional parameters) as input, imports the layers to the
temporary GRASS DB, runs your addon and exports the results

The QGIS-GRASS-plugin seems to work also in QGIS 3. It is fully
possible to get addons into the GRASS-plugin. Yet, same as for
processing, you have to manipulate the installation (which probably not
all users would be allowed and able to do).

In any case, with current solutions you will have to recreate the UI in
QGIS.


Stefan,

what I seek for is easier than a).

- GRASS GIS has to be installed
- GRASS GIS data base will be the one to work with
- QGIS 2.18, which it LTR, is the preferred version

I think the "Processing" approach is a good one since it requires
minimal scripting/translation and copying of some files in the right
places.

Else, the PyQTGUI approach might also be good despite the fact that we
have to find a way to ship it together with an add-on. It will work with
a script to execute that creates the required soft-link(s) and some
clicks to activate it as an independent "Experimental" addon.

Now,

there is this weird situation now where I cannot install the add-on module I
wrote under Windows using `g.extension`.  The module is not published in
the official repository (and I have to get a permission before I do so).
The current framework does not support compiling from source.

So, it's difficulty to proceed in testing anything.

How do we compile and package a single GRASS GIS Addon binary to proceed
with testing under Windows?

Nikos


signature.asc
Description: PGP signature
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-12 Thread Nikos Alexandris

* Helmut Kudrnovsky  [2018-10-12 01:26:00 -0700]:


3. QGIS GRASS Plugin


I think QGIS GRASS Plugin is something different; it's not about using GRASS
modules/addons in QGIS


I think it is possible to make a(ny) GRASS module available to it,
as it is mentioned at
https://docs.qgis.org/2.18/en/docs/user_manual/grass_integration/grass_integration.html#customizing-the-grass-toolbox.

I have not done yet so. There is a further link there, cannot access its
content however.

Nikos




signature.asc
Description: PGP signature
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-12 Thread Nikos Alexandris

* Helmut Kudrnovsky  [2018-10-12 01:18:37 -0700]:


5. Ondřej suggested also another possibility: if an Addon is >installed,

maybe

then, inside QGIS: GRASS GIS Plugin > GRASS GIS shell > run `r.>

--ui`

would suffice?

Any Windows user possibly to try this last option?


What is a GRASS GIS shell within the QGIS GRASS plugin?


Helmut,

assuming all QGIS and GRASS-GIS things are installed properly (testing
now with 2.18),

- Plugins > Manage and Install Plugins... > GRASS 7

- Once installed/enabled, select a GRASS GIS Location/Mapset
directory in the Browser Panel 


- Click on the "GRASS Tools" icon/button or achieve the same via

Plugins > GRASS > Open GRASS Tools

- First available option under GRASS MODULES is the 'GRASS shell'.

There, it is possible to do something like `g.region --ui`.

N


signature.asc
Description: PGP signature
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-12 Thread Stefan Blumentrath
Dear Nikos and others,

First of all, we have to clarify if you:
a) want a solution that does not require a GRASS database (meaning a Processing 
like approach) or
b) if an existing GRASS database is acceptable as a requirement to run your 
addon

If the answer is a), the Situation (in QGIS 3) regarding GRASS integration in 
QGIS is indeed far from ideal.
In order to change that, a bigger effort seems necessary (as envisioned in the 
GSoC).

As a workaround for a) you could write a Processing Python script as a wrapper 
that uses the grass --exec functionality with a temporary GRASS DB and:
1) installs the addon if it does not exist
2) takes QGIS layers (and additional parameters) as input, imports the layers 
to the temporary GRASS DB, runs your addon and exports the results

The QGIS-GRASS-plugin seems to work also in QGIS 3. It is fully possible to get 
addons into the GRASS-plugin. Yet, same as for processing, you have to 
manipulate the installation (which probably not all users would be allowed and 
able to do).

In any case, with current solutions you will have to recreate the UI in QGIS.

Cheers
Stefan



-Original Message-
From: grass-dev  On Behalf Of Nikos 
Alexandris
Sent: fredag 12. oktober 2018 02:31
To: Ondřej Pešek 
Cc: GRASS developers list 
Subject: Re: [GRASS-dev] Access to GRASS GIS addons

* Ondřej Pešek  [2018-10-11 20:20:40 +0200]:

>čt 11. 10. 2018 v 17:24 odesílatel Vaclav Petras 
>napsal:
>
>> A 2016 GSoC project took different approach which could be reused in 
>> QGIS independently from the current GRASS Plugin or Processing plugin 
>> approaches. This is a good base for future work, perhaps even for 
>> auto-generating the files needed for GRASS plugin or Processing plugin.
>>
>> https://trac.osgeo.org/grass/wiki/GSoC/2016/PyQtGUI
>>
>
>
>If you start QGIS from the GRASS GIS shell, then you can use a module 
>g.pyqt from the above-mentioned GSoC project and parse the name of the 
>AddOn as a parameter. It will generate the fully-working GUI for you.
>
>So if you want to create a QGIS plugin and don't want to create the GUI 
>from scratch, then you can call something like `g.pyqt r.estimap` after 
>clicking on the icon of the plugin and it's done. However, it will 
>still work just with maps in GRASS, it will not import them into QGIS 
>or something, and there is also this strange thing about running QGIS 
>from the GRASS GIS shell.
>
>And I didn't touch the code for some time, so there are still some 
>places which should be improved. But it should be working if you have 
>your AddOn installed in GRASS.
>
>PS: I believe that the code can be also re-written to generate the QGIS 
>plugin GUI without all those strange necessities without so much work, 
>but unfortunately I don't have enough time to do it in the near future.

Thank you Ondřej, also through the list.

(@all: we are not far away with Ondřej these days and he already helped me, 
i.e. took time earlier in August and explained how it works under Linux, and 
during the last days we did make it work on-site--I am yet to try it on a 
Windows box though.)

However, I try to collect as much information as I can about it in order to 
find the best solution for Windows users.  And I think it is a question that is 
of interest for all of us, users of GRASS GIS and QGIS, regardless of the OS.


Following options:

1. PyQTGUI

- Works under Linux for QGIS 2.x,
- Requires softlinking the Addon's directory which should reside inside
  the PyQTGUI (and possible named without a dot) to QGIS' plugins
  directory -- I guess this can be scripted
- Would require to ship the Addon with the complete PyQTGUI
- Yet to test under Windows

2. PyQGIS?

3. QGIS GRASS Plugin

4. QGIS Processing -- see also: https://gis.stackexchange.com/a/223770/5256

5. Ondřej suggested also another possibility: if an Addon is installed, maybe 
then, inside QGIS: GRASS GIS Plugin > GRASS GIS shell > run `r. --ui` 
would suffice?

Any Windows user possibly to try this last option?


Note, there is an "answer" by @Vaclav at 
https://gis.stackexchange.com/a/173536/5256, which is rather discouraging for 
GRASS GIS Addons through QGIS. I hope we can update it.

Nikos
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-12 Thread Helmut Kudrnovsky
>3. QGIS GRASS Plugin

I think QGIS GRASS Plugin is something different; it's not about using GRASS
modules/addons in QGIS



-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-12 Thread Helmut Kudrnovsky
>5. Ondřej suggested also another possibility: if an Addon is >installed,
maybe 
>then, inside QGIS: GRASS GIS Plugin > GRASS GIS shell > run `r.>
--ui` 
>would suffice? 
>
>Any Windows user possibly to try this last option? 

What is a GRASS GIS shell within the QGIS GRASS plugin?



-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-11 Thread Nikos Alexandris

* Ondřej Pešek  [2018-10-11 20:20:40 +0200]:


čt 11. 10. 2018 v 17:24 odesílatel Vaclav Petras 
napsal:


A 2016 GSoC project took different approach which could be reused in QGIS
independently from the current GRASS Plugin or Processing plugin
approaches. This is a good base for future work, perhaps even for
auto-generating the files needed for GRASS plugin or Processing plugin.

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




If you start QGIS from the GRASS GIS shell, then you can use a module
g.pyqt from the above-mentioned GSoC project and parse the name of the
AddOn as a parameter. It will generate the fully-working GUI for you.

So if you want to create a QGIS plugin and don't want to create the GUI
from scratch, then you can call something like `g.pyqt r.estimap` after
clicking on the icon of the plugin and it's done. However, it will still
work just with maps in GRASS, it will not import them into QGIS or
something, and there is also this strange thing about running QGIS from the
GRASS GIS shell.

And I didn't touch the code for some time, so there are still some places
which should be improved. But it should be working if you have your AddOn
installed in GRASS.

PS: I believe that the code can be also re-written to generate the QGIS
plugin GUI without all those strange necessities without so much work, but
unfortunately I don't have enough time to do it in the near future.


Thank you Ondřej, also through the list.

(@all: we are not far away with Ondřej these days and he already helped me,
i.e. took time earlier in August and explained how it works under Linux, and
during the last days we did make it work on-site--I am yet to try it on a
Windows box though.)

However, I try to collect as much information as I can about it in order to
find the best solution for Windows users.  And I think it is a question
that is of interest for all of us, users of GRASS GIS and QGIS,
regardless of the OS.


Following options:

1. PyQTGUI

- Works under Linux for QGIS 2.x,
- Requires softlinking the Addon's directory which should reside inside
 the PyQTGUI (and possible named without a dot) to QGIS' plugins
 directory -- I guess this can be scripted
- Would require to ship the Addon with the complete PyQTGUI
- Yet to test under Windows

2. PyQGIS?

3. QGIS GRASS Plugin

4. QGIS Processing -- see also: https://gis.stackexchange.com/a/223770/5256

5. Ondřej suggested also another possibility: if an Addon is installed, maybe
then, inside QGIS: GRASS GIS Plugin > GRASS GIS shell > run `r. --ui`
would suffice?

Any Windows user possibly to try this last option?


Note, there is an "answer" by @Vaclav at
https://gis.stackexchange.com/a/173536/5256, which is rather
discouraging for GRASS GIS Addons through QGIS. I hope we can update it.

Nikos


signature.asc
Description: PGP signature
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-11 Thread Vaclav Petras
On Thu, Oct 11, 2018 at 2:20 PM Ondřej Pešek  wrote:

>
> PS: I believe that the code can be also re-written to generate the QGIS
> plugin GUI without all those strange necessities without so much work, but
> unfortunately I don't have enough time to do it in the near future.
>

Ondrej, thanks for the update. You can consider creating tickets on GitHub
with your ideas/future directions of development and you could put there
"help wanted" label to make it clear that there are plans for the project.
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-11 Thread Ondřej Pešek
čt 11. 10. 2018 v 17:24 odesílatel Vaclav Petras 
napsal:

> A 2016 GSoC project took different approach which could be reused in QGIS
> independently from the current GRASS Plugin or Processing plugin
> approaches. This is a good base for future work, perhaps even for
> auto-generating the files needed for GRASS plugin or Processing plugin.
>
> https://trac.osgeo.org/grass/wiki/GSoC/2016/PyQtGUI
>


If you start QGIS from the GRASS GIS shell, then you can use a module
g.pyqt from the above-mentioned GSoC project and parse the name of the
AddOn as a parameter. It will generate the fully-working GUI for you.

So if you want to create a QGIS plugin and don't want to create the GUI
from scratch, then you can call something like `g.pyqt r.estimap` after
clicking on the icon of the plugin and it's done. However, it will still
work just with maps in GRASS, it will not import them into QGIS or
something, and there is also this strange thing about running QGIS from the
GRASS GIS shell.

And I didn't touch the code for some time, so there are still some places
which should be improved. But it should be working if you have your AddOn
installed in GRASS.

PS: I believe that the code can be also re-written to generate the QGIS
plugin GUI without all those strange necessities without so much work, but
unfortunately I don't have enough time to do it in the near future.
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-11 Thread Vaclav Petras
On Thu, Oct 11, 2018 at 10:28 AM Moritz Lennert <
mlenn...@club.worldonline.be> wrote:
>
> Also note that there was a GSoC project to try to implement
> functionality that would make integration easier:
>
> https://trac.osgeo.org/grass/wiki/GSoC/2018/IntegrationInQGIS3
>
> but this seems to have been terminated early. At least I never saw a
> final report. Maybe Vaclav can update us on where we are at with this ?

Yes, it was terminated between 1st and 2nd evaluation. Code is useful for
reference.

A 2016 GSoC project took different approach which could be reused in QGIS
independently from the current GRASS Plugin or Processing plugin
approaches. This is a good base for future work, perhaps even for
auto-generating the files needed for GRASS plugin or Processing plugin.

https://trac.osgeo.org/grass/wiki/GSoC/2016/PyQtGUI
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-11 Thread Moritz Lennert

On 11/10/18 07:53, Stefan Blumentrath wrote:

Dear Nikos,

Approaches are a bit different for Processing and the GRASS plugin, though both 
do not allow usage of GRASS addons out-of-the-box.
Assuming you are aiming at integration in Processing have a look here:
https://gis.stackexchange.com/questions/150100/how-to-add-my-own-grass-algorithms-to-processing
and
https://github.com/qgis/QGIS/blob/b3d2619976a69d7fb67b884492da491dfaba287c/python/plugins/processing/algs/grass7/description/r.horizon.height.txt
on how you would have to tweak local GRASS and QGIS installation.

For less experienced users that are supposed to use the addon, you would 
probably want to write a little installation routine for your addon, that puts 
txt files into right places in the installation and also installs the GRASS 
addon systemwide...


Also note that there was a GSoC project to try to implement 
functionality that would make integration easier:


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

but this seems to have been terminated early. At least I never saw a 
final report. Maybe Vaclav can update us on where we are at with this ?


See also the discussions here:

https://lists.osgeo.org/pipermail/grass-dev/2018-February/087353.html

Moritz
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-10 Thread Stefan Blumentrath
Dear Nikos,

Approaches are a bit different for Processing and the GRASS plugin, though both 
do not allow usage of GRASS addons out-of-the-box.
Assuming you are aiming at integration in Processing have a look here:
https://gis.stackexchange.com/questions/150100/how-to-add-my-own-grass-algorithms-to-processing
and
https://github.com/qgis/QGIS/blob/b3d2619976a69d7fb67b884492da491dfaba287c/python/plugins/processing/algs/grass7/description/r.horizon.height.txt
on how you would have to tweak local GRASS and QGIS installation.

For less experienced users that are supposed to use the addon, you would 
probably want to write a little installation routine for your addon, that puts 
txt files into right places in the installation and also installs the GRASS 
addon systemwide...

Cheers
Stefan

-Original Message-
From: grass-dev  On Behalf Of Nikos 
Alexandris
Sent: onsdag 10. oktober 2018 17:45
To: qgis-develo...@lists.osgeo.org
Cc: grass-dev@lists.osgeo.org
Subject: [GRASS-dev] Access to GRASS GIS addons

Dear QGIS developers,

I'd much appreciate some response in the following questions.

I rarely use Windows, yet I would like to learn about the latest status in 
accessing GRASS GIS addons (not only regular modules) through QGIS under 
Windows.

If I write an addon for GRASS GIS, can I then provide/ensure access to it for 
Windows users of QGIS?

Thank you, Nikos
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Access to GRASS GIS addons

2018-10-10 Thread Nikos Alexandris

(Apologies for re-posting; I was not subscribed to the qgis-developer list
before)

Dear QGIS developers,

I'd much appreciate some response in the following questions.

I rarely use Windows, yet I would like to learn about the latest status in
accessing GRASS GIS addons (not only regular modules) through QGIS under
Windows.

If I write an addon for GRASS GIS, can I then provide/ensure access to it for
Windows users of QGIS?

The are related documentations:

- 
https://docs.qgis.org/testing/en/docs/user_manual/grass_integration/grass_integration.html?highlight=grass#customizing-the-grass-toolbox
- https://qgis.org/en/site/getinvolved/development/addinggrasstools.html

Are these up-to-date?

Thank you, Nikos


signature.asc
Description: PGP signature
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] Access to GRASS GIS addons

2018-10-10 Thread Nikos Alexandris

Dear QGIS developers,

I'd much appreciate some response in the following questions.

I rarely use Windows, yet I would like to learn about the latest status in
accessing GRASS GIS addons (not only regular modules) through QGIS under
Windows.

If I write an addon for GRASS GIS, can I then provide/ensure access to it for
Windows users of QGIS?

Thank you, Nikos


signature.asc
Description: PGP signature
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev