[Qgis-user] Refreshing Elevation Profile View after Loading Data using .loadLayerDefinition

2024-08-12 Thread Drexel Peter via QGIS-User
Dear list,
I am using QgsLayerDefinition().loadLayerDefinition() to load a QGIS-Layer into 
QGIS 3.38.

Using "Log = QgsLayerDefinition().loadLayerDefinition("pathtofile/xxx.qlr", 
QgsProject.instance(),QgsProject.instance().layerTreeRoot())" in a Script or in 
the Python-Console works well to open some elevation data into the layer table 
and the main view.
But if I want to see the same Data in an Elevation-Profile-View the dataset 
does not show up in an already opened Elevation-Profile-View. I have to close 
and reopen the Elevation Profile View to see the loaded Dataset.

To reproduce:

* Start QGIS

* Load any Elevation Data and export a qlr-file for the 
Elevation-Dataset. Unload (Close) the Dataset again.

* Load another Elevation Dataset

* Open an Elevation-Profile-View  (View - Elevation-Profile) and draw a 
Line - you can see the profile plot for the loaded dataset.

* Keep the Elevation-Profile-View opened and Run "Log = 
QgsLayerDefinition().loadLayerDefinition("pathtofile/xxx.qlr", 
QgsProject.instance(),QgsProject.instance().layerTreeRoot())" in the python 
console - adjust the path to your saved .qlr-File). The Elevation-Dataset is 
loaded to the Layer-List und to the Main Map-View but not loaded to the 
Elevation-Profile-View and not to the Layer-List of the Elevation-Profile.

Is there anything I can do to "refresh" the Elevation-Profile-View and the 
Layer List of the Elevation Profile?

Thanks
Best regards
Peter







___
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] Showing 2D-Data in QGIS Elevation Profile View QGIS 3.38

2024-07-11 Thread Drexel Peter via QGIS-User
Hallo,
In the Elevation-settings of the Layer-Properties of a 3D-Shapefile (shapeZ) I 
can select one of the 3 Clamping-Types "Clamped to Terrain", "Relative to 
Terrain" or "Absolute".
In the Elevation-settings of the Layer-Properties of a 2D-Shapefile I can only 
select one of 2 Clamping-Types "Clamped to Terrain" or "Absolute".
I want to draw 2D-Line Features (in my case Contour-Lines) "draped" on the 
Terrain-Line in the Elevation Profile View. Each time the Profile-Line crosses 
a Contour-Line a Point-Symbol should be drawn "on" the Profile-Line in the 
Elevation Profile View.

* When I select "Clamped to Terrain" the Point-Symbol is drawn at 
Elevation 0m

* When I select "Absolute" the Point-Symbol is again drawn at Elevation 
0m

* For 2D-Data I cannot select "Relative to Terrain"

In my Point of View "Clamped to Terrain" should do the trick but it does not...
Is there anyone out there who can help or at least is able to replicate the 
behavior?

Regards
Peter


___
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] passing parameters to QGIS Python-Script started via Command Line

2022-08-08 Thread Drexel Peter via Qgis-user
Hi everyone,
My goal: I want to open QGIS using the Command-Line, load a specific project, 
select specific features and zoom to the selected features.
What sounds rather difficult is actually mostly solvable using the following:
"C:\Program Files\QGIS 3.16\bin\qgis-ltr-bin.exe" -p "d:\standardebenen.qgs" 
--code myscript.py

This opens QGIS with the Project d:\standardebenen.qgs and after that it runs 
the script "myscript.py".
Within the scrip I can do everything what I can do in a Python-script, so there 
I can select some features in a layer and show that selection.
But this selections are "hard-coded" in the script, I cannot pass over these 
parameters to the myscript.py.
In "Pure Python" I can pass parameters to a Python Script using "python 
myscript.py arg1 arg2 arg3".
This seems to be not working in the QGIS-Command-Line  as the parameters are 
interpreted as "layers to load".
Am I right with my analysis?
One workaround is to write the parameters to al file and use this file within 
the myscript.py to define the selections. But this is very unhandy...
Are there any ideas from any QGIS-Expert to solve my problem?

If this cannot be solved in the current version of QGIS is one of the 
developers willing to get in contact with me to make an offer the implement 
this feature ?
Thanks
Peter
___
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-Developer] Memory Leak / Slowdown?

2020-04-20 Thread Drexel Peter
Hi Matthias,
they both do not work…
So I will make a Ticket I think…
Thanks anyway Matthias for your great support!

Best greetings
Peter



Von: Matthias 
Gesendet: Montag, 20. April 2020 17:21
An: Drexel Peter ; qgis-user@lists.osgeo.org; 
qgis-develo...@lists.osgeo.org
Betreff: Re: AW: AW: [QGIS-Developer] Memory Leak / Slowdown?

Hi Peter,

Happy you found a way.

Can you try proposals number 2 and 3 from my previous email? If they do not 
help, please open a ticket.

Bests
Matthias




20 April 2020 17:14 Drexel Peter 
mailto:peter.dre...@vorarlberg.at>> wrote:
Hi Matthias,
Thanks to your hints I found a way:
The script also works if I do not add the Layer to the Project but directly 
save the Sld-Style. So I can also skip clearing the QgsProject.instance.

vlayer=QgsVectorLayer (pfad ,sfileOhneExt,"ogr")
#QgsProject.instance().addMapLayer(vlayer)
vlayer.saveSldStyle (sldpfad)
#QgsProject.instance().clear()

But besides my personal “success”: including the 2 Lines should not lead to 
rising time /memory consumption or am I wrong?
Should I make a ticket?

Peter

Von: Matthias mailto:matth...@opengis.ch>>
Gesendet: Montag, 20. April 2020 15:40
An: Drexel Peter 
mailto:peter.dre...@vorarlberg.at>>; 
qgis-user@lists.osgeo.org<mailto:qgis-user@lists.osgeo.org>; 
qgis-develo...@lists.osgeo.org<mailto:qgis-develo...@lists.osgeo.org>
Betreff: Re: AW: [QGIS-Developer] Memory Leak / Slowdown?

Hi Peter,

It's possible that a part of the cleanup only happens on the next event loop 
run.

Questions / things to try:

- Do you really need to add them to the project or is a layer without adding it 
to the project good enough for your purpose?
- Can you run this in batches of ~100 (or even 1) each and then trigger the 
next batch on a new event loop invocation, e.g. by using QTimer.singleShot()
- The easiest thing would be calling QgsApplication.processEvents(), but be 
warned that using this is known for introducing instabilities, depending on the 
context in which it is called

Matthias



20 April 2020 15:11 Drexel Peter 
mailto:peter.dre...@vorarlberg.at>> wrote:
Hi Matthias,
yes, the same with a clean new profile.
4 iterations per second at the begining, 1 very 6 seconds at the end…









…









QGIS-Version


3.12.1-București


QGIS-Codeversion


121cc00ff0<https://github.com/qgis/QGIS/commit/121cc00ff0>


Kompiliert gegen Qt


5.11.2


Laufendes Qt


5.11.2


Kompiliert mit GDAL/OGR


3.0.4


Läuft mit GDAL/OGR


3.0.4


Kompiliert mit GEOS


3.8.1-CAPI-1.13.3


Läuft mit GEOS


3.8.1-CAPI-1.13.3


Kompiliert mit SQLite


3.29.0


Läuft mit SQLite


3.29.0


PostgreSQL-Client-Version


11.5


SpatiaLite-Version


4.3.0


QWT-Version


6.1.3


QScintilla2-Version


2.10.8


Kompiliert mit PROJ


6.3.1


Läuft mit PROJ


Rel. 6.3.1, February 10th, 2020


BS-Version


Windows 10 (10.0)


Aktive Python-Erweiterungen


db_manager;
MetaSearch;
processing





Von: Matthias Kuhn mailto:matth...@opengis.ch>>
Gesendet: Montag, 20. April 2020 12:50
An: Drexel Peter 
mailto:peter.dre...@vorarlberg.at>>; 
qgis-user@lists.osgeo.org<mailto:qgis-user@lists.osgeo.org>
Betreff: Re: [QGIS-Developer] Memory Leak / Slowdown?


Hi Peter,

Did you try this on a clean new profile with no plugins installed?

Bests

Matthias
On 4/20/20 11:08 AM, Drexel Peter wrote:
Hi,
I use a Python-Script to load all shapefiles in a directory tree one by one and 
export the sld-files.
It works fine, but slows down incredible after ~100 files.
So I tried the following barebone script with just the essentials  (load 
shapefile, add it to the map canvas, remove it again and then clear the 
project) in a loop and I get the same behavior…

from datetime import datetime
for i in range(1, 1000):
vlayer=QgsVectorLayer ("aShapeFile.shp" ,"run  " + str(i) + " 
at " + datetime.now().strftime('%H:%M:%S') ,"ogr")
QgsProject.instance().addMapLayer(vlayer)
QgsProject.instance().removeMapLayer(vlayer.id())
QgsProject.instance().clear()

Same result,  the Script slows down after every iteration in the loop AND 
QGIS-memory consumption goes up!
Do I need to do some garbage cleaning / what am I doing wrong / is this a 
Memory leak?

Thanks everybody for any hints / help!

Peter


___ QGIS-Developer mailing 
listqgis-develo...@lists.osgeo.org<mailto:qgis-develo...@lists.osgeo.org> List 
info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: 
https://lists.osgeo.org/mailman/listinfo/qgis-developer


___
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-Developer] Memory Leak / Slowdown?

2020-04-20 Thread Drexel Peter
Hi Matthias,
Thanks to your hints I found a way:
The script also works if I do not add the Layer to the Project but directly 
save the Sld-Style. So I can also skip clearing the QgsProject.instance.

vlayer=QgsVectorLayer (pfad ,sfileOhneExt,"ogr")
#QgsProject.instance().addMapLayer(vlayer)
vlayer.saveSldStyle (sldpfad)
#QgsProject.instance().clear()

But besides my personal “success”: including the 2 Lines should not lead to 
rising time /memory consumption or am I wrong?
Should I make a ticket?

Peter

Von: Matthias 
Gesendet: Montag, 20. April 2020 15:40
An: Drexel Peter ; qgis-user@lists.osgeo.org; 
qgis-develo...@lists.osgeo.org
Betreff: Re: AW: [QGIS-Developer] Memory Leak / Slowdown?

Hi Peter,

It's possible that a part of the cleanup only happens on the next event loop 
run.

Questions / things to try:

- Do you really need to add them to the project or is a layer without adding it 
to the project good enough for your purpose?
- Can you run this in batches of ~100 (or even 1) each and then trigger the 
next batch on a new event loop invocation, e.g. by using QTimer.singleShot()
- The easiest thing would be calling QgsApplication.processEvents(), but be 
warned that using this is known for introducing instabilities, depending on the 
context in which it is called

Matthias



20 April 2020 15:11 Drexel Peter 
mailto:peter.dre...@vorarlberg.at>> wrote:
Hi Matthias,
yes, the same with a clean new profile.
4 iterations per second at the begining, 1 very 6 seconds at the end…









…









QGIS-Version


3.12.1-București


QGIS-Codeversion


121cc00ff0<https://github.com/qgis/QGIS/commit/121cc00ff0>


Kompiliert gegen Qt


5.11.2


Laufendes Qt


5.11.2


Kompiliert mit GDAL/OGR


3.0.4


Läuft mit GDAL/OGR


3.0.4


Kompiliert mit GEOS


3.8.1-CAPI-1.13.3


Läuft mit GEOS


3.8.1-CAPI-1.13.3


Kompiliert mit SQLite


3.29.0


Läuft mit SQLite


3.29.0


PostgreSQL-Client-Version


11.5


SpatiaLite-Version


4.3.0


QWT-Version


6.1.3


QScintilla2-Version


2.10.8


Kompiliert mit PROJ


6.3.1


Läuft mit PROJ


Rel. 6.3.1, February 10th, 2020


BS-Version


Windows 10 (10.0)


Aktive Python-Erweiterungen


db_manager;
MetaSearch;
processing





Von: Matthias Kuhn mailto:matth...@opengis.ch>>
Gesendet: Montag, 20. April 2020 12:50
An: Drexel Peter 
mailto:peter.dre...@vorarlberg.at>>; 
qgis-user@lists.osgeo.org<mailto:qgis-user@lists.osgeo.org>
Betreff: Re: [QGIS-Developer] Memory Leak / Slowdown?


Hi Peter,

Did you try this on a clean new profile with no plugins installed?

Bests

Matthias
On 4/20/20 11:08 AM, Drexel Peter wrote:
Hi,
I use a Python-Script to load all shapefiles in a directory tree one by one and 
export the sld-files.
It works fine, but slows down incredible after ~100 files.
So I tried the following barebone script with just the essentials  (load 
shapefile, add it to the map canvas, remove it again and then clear the 
project) in a loop and I get the same behavior…

from datetime import datetime
for i in range(1, 1000):
vlayer=QgsVectorLayer ("aShapeFile.shp" ,"run  " + str(i) + " 
at " + datetime.now().strftime('%H:%M:%S') ,"ogr")
QgsProject.instance().addMapLayer(vlayer)
QgsProject.instance().removeMapLayer(vlayer.id())
QgsProject.instance().clear()

Same result,  the Script slows down after every iteration in the loop AND 
QGIS-memory consumption goes up!
Do I need to do some garbage cleaning / what am I doing wrong / is this a 
Memory leak?

Thanks everybody for any hints / help!

Peter


___ QGIS-Developer mailing 
listqgis-develo...@lists.osgeo.org<mailto:qgis-develo...@lists.osgeo.org> List 
info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: 
https://lists.osgeo.org/mailman/listinfo/qgis-developer

___
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-Developer] Memory Leak / Slowdown?

2020-04-20 Thread Drexel Peter
Hi Matthias,
yes, the same with a clean new profile.
4 iterations per second at the begining, 1 very 6 seconds at the end…









…









QGIS-Version


3.12.1-București


QGIS-Codeversion


121cc00ff0<https://github.com/qgis/QGIS/commit/121cc00ff0>


Kompiliert gegen Qt


5.11.2


Laufendes Qt


5.11.2


Kompiliert mit GDAL/OGR


3.0.4


Läuft mit GDAL/OGR


3.0.4


Kompiliert mit GEOS


3.8.1-CAPI-1.13.3


Läuft mit GEOS


3.8.1-CAPI-1.13.3


Kompiliert mit SQLite


3.29.0


Läuft mit SQLite


3.29.0


PostgreSQL-Client-Version


11.5


SpatiaLite-Version


4.3.0


QWT-Version


6.1.3


QScintilla2-Version


2.10.8


Kompiliert mit PROJ


6.3.1


Läuft mit PROJ


Rel. 6.3.1, February 10th, 2020


BS-Version


Windows 10 (10.0)


Aktive Python-Erweiterungen


db_manager;
MetaSearch;
processing





Von: Matthias Kuhn 
Gesendet: Montag, 20. April 2020 12:50
An: Drexel Peter ; qgis-user@lists.osgeo.org
Betreff: Re: [QGIS-Developer] Memory Leak / Slowdown?


Hi Peter,

Did you try this on a clean new profile with no plugins installed?

Bests

Matthias
On 4/20/20 11:08 AM, Drexel Peter wrote:
Hi,
I use a Python-Script to load all shapefiles in a directory tree one by one and 
export the sld-files.
It works fine, but slows down incredible after ~100 files.
So I tried the following barebone script with just the essentials  (load 
shapefile, add it to the map canvas, remove it again and then clear the 
project) in a loop and I get the same behavior…

from datetime import datetime
for i in range(1, 1000):
vlayer=QgsVectorLayer ("aShapeFile.shp" ,"run  " + str(i) + " 
at " + datetime.now().strftime('%H:%M:%S') ,"ogr")
QgsProject.instance().addMapLayer(vlayer)
QgsProject.instance().removeMapLayer(vlayer.id())
QgsProject.instance().clear()

Same result,  the Script slows down after every iteration in the loop AND 
QGIS-memory consumption goes up!
Do I need to do some garbage cleaning / what am I doing wrong / is this a 
Memory leak?

Thanks everybody for any hints / help!

Peter




___

QGIS-Developer mailing list

qgis-develo...@lists.osgeo.org<mailto:qgis-develo...@lists.osgeo.org>

List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
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] Memory Leak / Slowdown?

2020-04-20 Thread Drexel Peter
Hi,
I use a Python-Script to load all shapefiles in a directory tree one by one and 
export the sld-files.
It works fine, but slows down incredible after ~100 files.
So I tried the following barebone script with just the essentials  (load 
shapefile, add it to the map canvas, remove it again and then clear the 
project) in a loop and I get the same behavior...

from datetime import datetime
for i in range(1, 1000):
vlayer=QgsVectorLayer ("aShapeFile.shp" ,"run  " + str(i) + " 
at " + datetime.now().strftime('%H:%M:%S') ,"ogr")
QgsProject.instance().addMapLayer(vlayer)
QgsProject.instance().removeMapLayer(vlayer.id())
QgsProject.instance().clear()

Same result,  the Script slows down after every iteration in the loop AND 
QGIS-memory consumption goes up!
Do I need to do some garbage cleaning / what am I doing wrong / is this a 
Memory leak?

Thanks everybody for any hints / help!

Peter

___
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] QGIS 3, Import a project into an existing / or the open project, Python

2018-06-11 Thread Drexel Peter
Hi,
I need some advice on how to import an existing project into my open project 
using Python in Qgis 3.
I am looking for something similar to 
https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/loadproject.html,
 but
the script should add the content of a .qgs-File (the layers, structure, 
styling etc) to some already loaded layers/groups in a Qgis-Session.
Any ideas?
Thanks
Peter




___
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 Processing Clip

2018-03-23 Thread Drexel Peter
Thanks to both for the answers,
It works now.
Sadly I have to accept the geometry errors at the moment, otherwise I would 
have to fix hundreds of 3. party-files…
Greetings,
Peter

__
Mag. Peter Drexel
Landesamt für Vermessung und 
Geoinformation<http://vogis.cnv.at/atlas3/init.aspx?hotspot=digitaler_atlas_vorarlberg%7cbasiskarten_und_bilder%7c1%3a1843%7c-55745.5870030623%7c233293.767395111%7chotspot0.gif%7cLandesamt+f%u00fcr+Vermessung+und+Geoinformation>
Johannitergasse 6 A-6800 Feldkirch
Tel: +43(0)5522/75482-60222, Fax: +43(0)5522/75482-6
E-Mail: peter.dre...@vorarlberg.at<mailto:peter.dre...@vorarlberg.at>, 
http://www.vorarlberg.at/lva

Rechtsverbindlichen Schriftverkehr (z.B. Anträge Rechtsmittel) richten Sie an:
E-Mail: 
landesvermessungs...@vorarlberg.at<mailto:landesvermessungs...@vorarlberg.at>, 
Fax: +43(0)5522/75482-6

Von: Andreas Neumann [mailto:a.neum...@carto.net]
Gesendet: Freitag, 23. März 2018 12:53
An: Drexel Peter
Cc: qgis-user@lists.osgeo.org
Betreff: Re: [Qgis-user] QGIS3 Processing Clip


Hi Peter,

You can find this setting in "Settings" --> "Options" --> "Processing" --> 
"General" --> "Invalid features filtering".

However, it is probably more advisable to fix the geometry errors, if it is 
feasible. The "Geometry checker" core plugin can help with this task.

Greetings,
Andreas

On 2018-03-23 11:30, Drexel Peter wrote:
Hi all,
In QGIS 3.0 I use native:clip in processing to clip a Shapefile with another 
shapefile.
The Import-Shapefile contains some invalid polygons so I get an error

Processing algorithm…
AlgorithmDialog
Input parameters:
{ 'INPUT' : 
'V:/Geodaten/Wasser/Einzugsgebiete/Vlbg_Umgebung/Einzugsgebiete_FGW/ezg_gesamt1_bearbeitet_3D_name.shp',
 'OVERLAY' : 'C:/temp/QGIS3/Clip-Maske.shp', 'OUTPUT' : 'memory:' }

Feature (0) has invalid geometry. Please fix the geometry or change the 
Processing setting to the "Ignore invalid input features" option.
Execution failed after 0.35 seconds

Loading resulting layers
Algorithm 'Clip' finished
__


In the Log-section of the Clip-Tool.

But where can change the setting to “Ignore invalid input features”?


Thanks
Peter

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org<mailto: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

[Qgis-user] QGIS3 Processing Clip

2018-03-23 Thread Drexel Peter
Hi all,
In QGIS 3.0 I use native:clip in processing to clip a Shapefile with another 
shapefile.
The Import-Shapefile contains some invalid polygons so I get an error

Processing algorithm...
AlgorithmDialog
Input parameters:
{ 'INPUT' : 
'V:/Geodaten/Wasser/Einzugsgebiete/Vlbg_Umgebung/Einzugsgebiete_FGW/ezg_gesamt1_bearbeitet_3D_name.shp',
 'OVERLAY' : 'C:/temp/QGIS3/Clip-Maske.shp', 'OUTPUT' : 'memory:' }

Feature (0) has invalid geometry. Please fix the geometry or change the 
Processing setting to the "Ignore invalid input features" option.
Execution failed after 0.35 seconds

Loading resulting layers
Algorithm 'Clip' finished
__


In the Log-section of the Clip-Tool.

But where can change the setting to "Ignore invalid input features"?


Thanks
Peter
___
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