Re: [Qgis-user] How to catch a QgsMapCanvas::emitExtentsChanged-signal?

2024-03-15 Thread Ludwig Kniprath via QGIS-User

Hi Bernhard, what about


iface.mapCanvas().extentsChanged.connect(lambda: print("the extent has 
changed!!!"))



Or something more usefull like


def extent_has_changed_slot():
    print(iface.mapCanvas().extent())

iface.mapCanvas().extentsChanged.connect(extent_has_changed_slot)


Btw, the *signal* is 'extentsChanged', 'emitExtentsChanged' is a 
*function*, which will trigger the emit of the signal.



So:

a) 'xxx' ist the signal-object, above 'iface.mapCanvas().extentsChanged'

b) extentsChanged is a signal without parameters, signals with 
parameters can be used in slot-functions with appropriate signatures.


Below a sample for a signal with parameters, see 
https://api.qgis.org/api/classQgsMapCanvas.html#a6c6f74644c9b273917a29e77b6400e89


def map_tool_was_set_slot(new_tool,old_tool):
    print(new_tool,old_tool)

iface.mapCanvas().mapToolSet.connect(map_tool_was_set_slot)


Hth

Ludwig


Am 14.03.24 um 15:48 schrieb Bernhard Seckinger via QGIS-User:

Hi,

I'm trying to write a plugin, that gets into action, whenever the user moves
or zooms the main map. I found the QgsMapCanvas::emitExtentsChanged() signal.
This is probably exactly, what I need. But I don't know, how to "catch" this
signal. I guess, this is somehow done with pyqtSignals, but I don't understand
how...

I found a tutorial (1) which explains how to use pyqtSignal with self defined
signals. I think I got this. But now I need to catch a signal which is defined
in the library. How to connect to this signal?

 From what I understand, my code should be something like:

def __init__():
 # with some pyqtSignal xxx:
 xxx.connect(my_fun)

def my_fun(some parameters?):
 # code to execute when extents changed

So two question remain:

a) What is xxx above?
b) Does "my_fun" need some parameters?

Any help is appreciated!

Thanks, Bernhard

(1) https://gis-ops.com/qgis-3-plugin-tutorial-pyqt-signal-slot-explained/

--
Bernhard Seckinger 
___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Problem with Python/Qgis

2023-12-12 Thread Ludwig Kniprath via QGIS-User

Hi Gael,

I'm using QGis on Linux Mint, an Ubuntu fork, with no problems, so just 
some notes.


- Did you follow 
https://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu?


- Did you run "sudo apt update" before "sudo apt install"?

- There seems to be an older installation, You could try "sudo apt-get 
purge qgis qgis-plugin-grass python3-qgis qgis-providers qgis-common" 
before...



hth

Ludwig


Am 12.12.23 um 16:57 schrieb Gael Kermarrec via QGIS-User:

Dear members,

I am trying to install Qgis from Ubuntu 20.04 but everytime I make 
sudo apt install qgis qgis-plugin-grass I become the following:



The following packages contain unsatisfied dependencies:
qgis: Depends on python3-qgis (= 1:3.22.16+32focal) but 
1:3.26.3+32focal-ubuntugis needs to be installed
Depends on qgis-providers (= 1:3.22.16+32focal) but 
1:3.26.3+32focal-ubuntugis needs to be installed
Depends on qgis-common (= 1:3.22.16+32focal) but 
1:3.26.3+32focal-ubuntugis needs to be installed
qgis-plugin-grass: Depends on qgis-plugin-grass-common (= 
1:3.22.16+32focal) but 1:3.26.3+32focal-ubuntugis needs to be installed

Depends on grass782
E: Unable to correct problems, defective packages are in "keep in the 
current state" mode.


I have no idea what I should do to make it works. Maybe somebody had 
the same problem, I would be grateful to get some support as I would 
like to work with QGis.


Thanks,

gael.


___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Printing Qgis shown layers in new version

2023-12-08 Thread Ludwig Kniprath via QGIS-User

Hi Asim,

I'm surprised that previous QGis versions should have returned three 
layers "Gasunie 2, Gasunie Z-509-05 and Wattinfra Kabelverbinding", 
because the legend image shows a single vector layer "Overzicht 
entities" with three classes, not three separate layers.


According to https://api.qgis.org/api/classQgsProject.html:

QgsProject.instance().mapLayers() => "Returns a map of all registered 
layers by layer ID."


Perhaps you previously had three separate layers bundled in a layer group?

Ludwig


Am 08.12.23 um 15:47 schrieb Asim al-sofi via QGIS-User:

Hi All,
I have a question related to printing out the shown layers in qgis.
I made a plugin that has worked fine in the older Qgis versions but 
not working properly in the new version.
The problem that iam facing is that the 
*QgsProject.instance().mapLayers().values() *does not show me the 
layers shown in qgis.
So in the previous version, the below image gives me the names of the 
layers *Gasunie 2, Gasunie Z-509-05 and Wattinfra Kabelverbinding*. 
But in the new Qgis version it gives me the names *Overzicht entities 
and openbasiskaart.nl *. Does anyone know 
how to tackle this problem?

Layers.png
Thanks in advance
Kind regards
Asim

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] zoomToLayers pyqgis

2023-11-18 Thread Ludwig Kniprath via QGIS-User

Hi Patrick,

what about

iface.mapCanvas().setExtent(layer.extent())
iface.mapCanvas().refresh()

or

iface.setActiveLayer(layer)

iface.zoomToActiveLayer()

hth

Ludwig

Am 18.11.23 um 09:32 schrieb Patrick Dunford via QGIS-User:

Good day to all

I want to call zoomToLayers in a pyqgis script to zoom the map canvas 
to a layer which I have just applied a filter to. I am not sure how to 
do it as all the documented uses of this method seem to apply to 
different things than to a layer.


If the layer is not the currently active layer is there a method of 
this that can be called on a particular layer or selecting a 
particular layer as active then using the call that uses the active 
layer.


e.g.

project =QgsProject.instance()

layer = project.mapLayersByName("Live Aerial Footprints")[0]

layer.setSubsetString(aerialFilter)

# insert code here to zoom to this layer



Thanks

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Readonly geometries

2023-10-25 Thread Ludwig Kniprath via QGIS-User

Oh my, QGis without GIS functionalities...


Not with on-board resources, I'm afraid, but some thoughts:


In QGis/PyQGis (script/plugin):

- connect the QgsVectorLayer::editingStarted-signal to 
disable/remove/hide the vertex-tool-icon and the "Advanced Digitizing 
Toolbar"


- connect the QgsVectorLayer::geometryChanged-signal emitted on 
geometry-change to restore the original geometry or make a rollback



In case of a server-client geo-database (f.e. PostGres/PostGis):

- implement a fine grained access control with dedicated 
users/permissions and revoke the update-privilege from geometry-column 
for some users


- implement a database-trigger, which prevents altering geometries


Just some ideas, there are certainly many more ...

Ludwig



Am 23.10.23 um 20:58 schrieb Simon Gröchenig via QGIS-User:

Hi list,
is it possible to set geometries to readonly while attributes are 
editable?

Simon

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] how to count overlays of objects

2023-08-19 Thread Ludwig Kniprath via QGIS-User

Hi Daniela,

possible solution:

1. run the "Union" algorithm that splits the input polygons

2. add a new integer-column to the "Union"-result-layer f. e. "num_overlays"

3. optionally an additional column with type "integer list" or "string", 
if You want to see afterwards, which features intersect, f. e. 
"overlay_ids"


4. run the script below, that performs a self-intersection for each 
feature to find the spatial identical overlaps (Note: Layer- and 
column-names hard coded, adjust if necessary)



union_layer = QgsProject.instance().mapLayersByName('Union')[0]

union_layer.startEditing()

for union_feature_1 in union_layer.getFeatures():
    num_overlays = 0
    overlay_ids = []
    for union_feature_2 in union_layer.getFeatures():
    if 
union_feature_1.geometry().equals(union_feature_2.geometry()) and 
union_feature_1.id() != union_feature_2.id():

    num_overlays += 1
    overlay_ids.append(union_feature_2.id())

    union_feature_1['num_overlays'] =  len(overlay_ids)
    # solution for column type "string" instead of "integer list":
    # union_feature_1['overlay_ids'] =  ','.join(str(id) for id in 
overlay_ids)

    union_feature_1['overlay_ids'] =  overlay_ids

    union_layer.updateFeature(union_feature_1)

union_layer.commitChanges()



hth

Ludwig





Am 18.08.23 um 16:15 schrieb Daniela Friebel via QGIS-User:


Dear Community

I have a vectorlayer with many objects (polygons) that overlap. Now I 
want to create a new layer, where each overlap results in a separate 
object, which has an attribute with the number of overlaps.


I have already tried various things, but have not yet found a 
solution. With the "union" tool I can generate the overlaps as 
objects, but I cannot count the number of overlaps.


I am grateful for any help and hints.

(I would like to count the overlaps to eventually create a heatmap. If 
there is a completely different way of doing this, I would also 
appreciate a tip).


Kind regards

Daniela


___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] QGIS3 quits after PyQt Script 2 run

2023-08-17 Thread Ludwig Kniprath via QGIS-User

Hi Julierme,

that's another and not a new problem, the button-widget and setFixedSize 
did not work before and even do not work in standalone-python outside QGis.


The reason is quite simple, we overlooked it before: double-underscores 
for the __init__-functions.



Here the running code, which does what You want (commented lines for 
QGis-usage, uncomment for standalone):



import sys
from PyQt5.QtCore import (QSize, Qt)
from PyQt5.QtWidgets import (QApplication,
 QWidget,
 QPushButton,
 QMainWindow)


class MainWindow(QMainWindow):
    def __init__(self):
    super().__init__()
    self.setWindowTitle("My App")
    button = QPushButton("Press Me!")
    self.setCentralWidget(button)
    self.setFixedSize(QSize(400, 300))


#app = QApplication(sys.argv)
window = MainWindow()
window.show()
#app.exec()




hth

Ludwig




Am 17.08.23 um 04:14 schrieb 1520 gis:

Hi Ludwig,

Thank you very much for your reply. You're right, QGIS stopped 
crashing, but now the button widget is not being carried out by the 
application window and neither the methods are working properly like 
the self.setFixedSize(QSize(400,300)). I am sending a window 
screenshot in attachment.


I appreciated your time and help.

Kind regards

Julierme

On Wed, Aug 16, 2023 at 4:07 PM Ludwig Kniprath via QGIS-User 
 wrote:


Hi Julierme,

I think Your problem is, that You try to create a new application
with "app = QApplication(sys.argv)" inside a running QGis, which
already is a running Qt-application.

Simplified code should perform without crash:

import sys
from PyQt5.QtCore import (QSize,Qt)
from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton,
QMainWindow)

class MainWindow(QMainWindow):
    def _init_(self):
    super()._init_()
    self.setWindowTitle("My App")
    button = QPushButton("Press Me!")


    self.setCentralWidget(button)
    self.setFixedSize(QSize(400,300))

window = MainWindow()
window.show()


hth

Ludwig

Am 16.08.23 um 19:15 schrieb 1520 gis via QGIS-User:

Hi all,

I wrote the PyQt script below and I am running it through QGIS3.
When I run it for the first time after opening it in QGIS3, the
application's window pops up smoothly. However, when I close the
window and run the script, QGIS3 readily quits.  That may be
something related to the event loop, but I'm unsure and don't
know how to stop the QGIS3 shutdown for the subsequent runs.  Any
hint on how to fix this issue will be very appreciated.

import sys
from PyQt5.QtCore import (QSize,
                          Qt)
from PyQt5.QtWidgets import (QApplication,
                              QWidget,
                              QPushButton,
                              QMainWindow)
class MainWindow(QMainWindow):
    def _init_(self):
        super()._init_()
        self.setWindowTitle("My App")
        button = QPushButton("Press Me!")


        self.setCentralWidget(button)
        self.setFixedSize(QSize(400,300))
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()
-- 
##

*Julierme G Pinheiro*
*SDI Expert & Geoprocessing Specialist*
Phone: +55 61 4-3569
Website: GIS

<https://www.udemy.com/course/qgis-server-para-iniciantes-instalacao-e-configuracao/>

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user



--
##
*Julierme G Pinheiro*
*SDI Expert & Geoprocessing Specialist*
Phone: +55 61 4-3569
Website: GIS 
<https://www.udemy.com/course/qgis-server-para-iniciantes-instalacao-e-configuracao/>___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] QGIS3 quits after PyQt Script 2 run

2023-08-16 Thread Ludwig Kniprath via QGIS-User

Hi Julierme,

I think Your problem is, that You try to create a new application with 
"app = QApplication(sys.argv)" inside a running QGis, which already is a 
running Qt-application.


Simplified code should perform without crash:

import sys
from PyQt5.QtCore import (QSize,Qt)
from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton, 
QMainWindow)


class MainWindow(QMainWindow):
    def _init_(self):
    super()._init_()
    self.setWindowTitle("My App")
    button = QPushButton("Press Me!")


    self.setCentralWidget(button)
    self.setFixedSize(QSize(400,300))

window = MainWindow()
window.show()


hth

Ludwig

Am 16.08.23 um 19:15 schrieb 1520 gis via QGIS-User:

Hi all,

I wrote the PyQt script below and I am running it through QGIS3. When 
I run it for the first time after opening it in QGIS3, the 
application's window pops up smoothly. However, when I close the 
window and run the script, QGIS3 readily quits.  That may be something 
related to the event loop, but I'm unsure and don't know how to stop 
the QGIS3 shutdown for the subsequent runs.  Any hint on how to fix 
this issue will be very appreciated.


import sys
from PyQt5.QtCore import (QSize,
                          Qt)
from PyQt5.QtWidgets import (QApplication,
                              QWidget,
                              QPushButton,
                              QMainWindow)
class MainWindow(QMainWindow):
    def _init_(self):
        super()._init_()
        self.setWindowTitle("My App")
        button = QPushButton("Press Me!")


        self.setCentralWidget(button)
        self.setFixedSize(QSize(400,300))
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()
--
##
*Julierme G Pinheiro*
*SDI Expert & Geoprocessing Specialist*
Phone: +55 61 4-3569
Website: GIS 



___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Equations cells imported to QGIS

2023-06-16 Thread Ludwig Kniprath via QGIS-User

Hi Simon,

Excel tables don't need to be saved as delimited text, they can be 
imported direct to QGis, f.e. with drag



Calculated contents in the spreadsheets are no problem, below my test 
with a simple table:


(note: screenshot from LibreOffice, I hope there is no difference using 
excel)


'Show Formula' as view-mode:


Normal view mode:


Imported to QGis: all cells with the last calculated and saved values


The imported table can than be joined to any existing vector-layer or 
converted to point-layer f.e. via Processing Toolbox > Vector creation > 
Create points layer from table.



Notes:

- You can even edit and save the imported table in QGis, but that will 
convert all formulas to simple alpha-numeric contents.


- Formulas are not refreshed automatically when imported to QGis, so the 
above field with the formula '=NOW()' (current time) will always show 
the last calculated value in QGis, not the actual time.



hth

Ludwig


Am 16.06.23 um 17:53 schrieb Simon via QGIS-User:

Hi all,

Excel spreadsheets can be imported into QGIS when they're formatted as 
Delimited text layers, but is it possible to import a spreadsheet with 
various cells containing different equations and then display them on 
a map?


Thanks,

Simon



___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Installing PC Raster

2023-03-21 Thread Ludwig Kniprath via QGIS-User

Hello Uwe,

I managed to install and run PCRaster on Windows in the past by 
following the YouTube-Video from Hans van der Kwast:


https://www.youtube.com/watch?v=pja_EX0tVZA=PLeuKJkIxCDj2xbV45C45wz3N89FvmTuSu

It describes the PCRaster-installation with the *same OSGeo4W-Installer 
as used for the QGis-Installation*.


Some comments on the YouTube-Site point to network/internet problems, I 
can't check it because I'm on linux.


hth

Ludwig


Am 21.03.23 um 08:59 schrieb Uwe via QGIS-User:


Hello list,

I installed PC Raster exactly (!) like it is explained in the YT video 
and I also saw the corresponding troubleshooting video. I use QGIS 
3.28.0 on Windows 10.


When loading the plugin, I get an error message saying: PCRaster must 
be installed and available in the current Python environment before 
the PCRaster algorithms can be used. Please see the plugin 
documentation for further details on how to install PCRaster.


In the video, it is said that the most common error comes from 
installing with a wrong version (old?) installer. Since I have only 
one QGIS version on my PC, that CANNOT be the problem. Besides that, I 
made sure to use the installer in my one and only QGIS directory.


Can anybody tell me what’s wrong?

Thanks and best regards, Uwe


___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] How to count number of layers loaded in layer panel of QGIS

2023-03-15 Thread Ludwig Kniprath via QGIS-User

That depends on the kind and state of layers You want to count:


# All layers (as listed in TOC, included: "non-drawable" and invalid layers)

layers = QgsProject.instance().layerTreeRoot().findLayers()
# list-items: "QgsLayerTreeLayer"


# All valid layers (included: "non-drawable"-layers):
layers = QgsProject.instance().mapLayers()
# list-items: layer-id


# Only visible, valid and "drawable" layers:
layers = iface.mapCanvas().layers()
# list-items: layer


for layer in layers:
    print(layer)

print(len(layers))


hth

Ludwig




Am 15.03.23 um 08:42 schrieb Paul N via QGIS-User:
I want to count number of layer loaded. How to count number of layers 
loaded in layer panel of QGIS.


Regards.

Paul N

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] QGIS and geopackages in sharepoint environement

2022-08-05 Thread Ludwig Kniprath via Qgis-user

Hi,

my personal experience with file based data storage in my very private 
cloud (something like sharepoint) was, that just opening a Qgis project 
with gpg layers causes many uploads, because each access (open, read, 
write... ) changes these files. In a multi-user environment this would 
certainly be much more complicated. So I would recommend a cloud-based 
database solution, perhaps google "postgis cloud hosting"?


Ludwig

Am 05.08.22 um 15:34 schrieb Guido Häfliger via Qgis-user:


Hello

We are discussing in our company to switch from local fileserver/NAS 
to Sharepoint (hosted in cloud). Will QGIS-projects and geopackages 
work on sharepoint environment or do we have to expect a lot of 
troubles? Have anybody experience with QGIS and geopackages on 
sharepoint? Will we encounter problems if geopackages are opened by 
several users?


Thanks for your advices in advance

Guido




Dipl. Ing. ETH Guido Häfliger
EDV/GIS-Spezialist
Tel. ++41 41 462 97 60
_guido.haefli...@vogelwarte.ch _
_www.vogelwarte.ch _

Schweizerische Vogelwarte | Seerose 1 | CH-6204 Sempach | Schweiz

Station ornithologique suisse | Seerose 1 | CH-6204 Sempach | Suisse
Stazione ornitologica svizzera | Seerose 1 | CH-6204 Sempach | Svizzera
Swiss Ornithological Institute | Seerose 1 | CH-6204 Sempach | 
Switzerland



___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] ReportLab integration into QGIS returns error message "no module named reportlab"

2022-05-09 Thread Ludwig Kniprath via Qgis-user

Hi,

Python inside QGis has no access to plugins installed by pip if called 
from normal shell.


But running "pip install reportlab" from the osgeo4w-shell should do it.


"pip show reportlab" after pip-from-shell-installation returns

"Location: 
c:\users\ludwi\appdata\local\programs\python\python39\lib\site-packages"


and "import reportlab" in QGis Python Console results 
"ModuleNotFoundError: No module named 'reportlab'"



"pip show reportlab" after osgeo4W-shell-installation returns

"Location: c:\users\ludwi\appdata\roaming\python\python39\site-packages"

and no error with "import reportlab" in QGis Python Console


Ludwig

Am 09.05.2022 um 04:52 schrieb julio cesar oliveira via Qgis-user:

Dears,

I want to use ReportLab in my own plugin which I have written for QGIS.

I have installed ReportLab for the python versions 3.10.

The package is respectively installed into the site-packages folder 
(e.g. 
C:\Users\olive\AppData\Local\Programs\Python\Python310\Lib\site-packages\reportLab).


If I want to use the tool in my plugin (from reportlab.pdfgen import 
canvas), the plugin returns the error "ImportError: no module named 
reportLab".


**

C:\PyQgis\cav> pip install reportlab

Requirement already satisfied: reportlab in 
c:\users\olive\appdata\local\programs\python\python310\lib\site-packages 
(3.6.9)
Requirement already satisfied: pillow>=4.0.0 in 
c:\users\olive\appdata\local\programs\python\python310\lib\site-packages 
(from reportlab) (9.1.0)


**

Do you have any other suggestions or ideas?


Thanks


___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user