Re: [Qgis-user] QGIS action to run a command in a terminal window on Windows

2024-05-06 Thread Ujaval Gandhi via QGIS-User
You can use the 'Execute SQL' algorithm from Processing Toolbox to run the SQL query. You can trigger any processing algorithm from an Action that will run on any platform. Example of how to run a processing algorithm from a Python Action https://courses.spatialthoughts.com/qgis-actions.html#creating-isochrones-using-ors-tools-plugin---Ujaval GandhiSpatial Thoughtswww.spatialthoughts.comOn Tue, May 7, 2024 at 5:39 AM Brent Wood via QGIS-User  wrote:






Hi,




I'm trying to create an action to run an SQL on a spatialite database & show the result as a QGIS action.




In Linux this works by running a script in an xterm, but I can't work out how to do something similar under widows.




Any suggestions?




Thanks





Brent Wood

Principal Technician, Fisheries
NIWA
DDI:  +64 (4) 3860529



From: QGIS-User  on behalf of Brent Wood via QGIS-User 
Sent: Wednesday, March 6, 2024 09:33
To: 'Qgis-user@lists.osgeo.org' 
Cc: Nyall Dawson 
Subject: [Qgis-user] Problem: Can't open Spatialite tables in QGIS on Windows
 




Hi,




We have been using QGIS & Spatialite for years and have recently encountered a problem in QGIS under Windows.




We connect to a spatialite database fine, we can list the tables, but when we try to open them we get an error:

db <...> table <...> is an invalid layer - not loaded (this is also written to the log)




I can open the db in DBManager and enter the query "select * from t_transect;" which runs & shows the data in the output pane.

When I try to load the layer as a map layer I get an error message referring me to the error log, but the log is empty.




This is using QGIS 3.34.1 on Windows.




The same database file works perfectly on Linux, with QGIS v3.34.3. A colleague has tried this & v3.36 on Windows with the same problem. The databases are generated with echo sounder data by the ESP3 application, and we have been able to use these in QGIS for
 years without problems until now.




Spatialite access the tables fine, the basic metadata is present:
select * from geometry_columns;
t_transect|geom_col|1|2|4326|0
t_echoint_transect_1d|geom_col|1|2|4326|0




The QGIS error message is not particularly helpful in determining the problem. Our workaround is to run the SQL we would have run in the QGIS database manager directly from the spatialite command line, exported to CSV & then open the CSV in QGIS, which works,
 but is not ideal.

 

For some context about these data:  The figure shows each "ping" from the echo sounder, scaled by the magnitude of the echo from fish, showing the location and density of fish encountered on each transect (ESP3 is used for the acoustic analysis). This dataset
 was from surveying a hill off the west coast of New Zealand (generated on Linux!).





Brent Wood

Principal Technician, Fisheries
NIWA
DDI:  +64 (4) 3860529









Brent Wood 
Principal Technician - GIS and Spatial Data Management
Programme Leader - Environmental Information Delivery
+64-4-386-0529

National Institute of Water & Atmospheric Research Ltd (NIWA)
301 Evans Bay Parade Hataitai Wellington New Zealand
Connect with NIWA: niwa.co.nz 
Facebook 
LinkedIn 
Twitter 
Instagram 
YouTube 






To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third
 parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems.

Note: This email is intended solely for the use of the addressee and may contain information that is confidential or subject to legal professional privilege. If you receive this email in error please immediately notify the sender and delete the email.



___
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


[Qgis-user] QGIS action to run a command in a terminal window on Windows

2024-05-06 Thread Brent Wood via QGIS-User
Hi,

I'm trying to create an action to run an SQL on a spatialite database & show 
the result as a QGIS action.

In Linux this works by running a script in an xterm, but I can't work out how 
to do something similar under widows.

Any suggestions?

Thanks

Brent Wood

Principal Technician, Fisheries
NIWA
DDI:  +64 (4) 3860529

From: QGIS-User  on behalf of Brent Wood via 
QGIS-User 
Sent: Wednesday, March 6, 2024 09:33
To: 'Qgis-user@lists.osgeo.org' 
Cc: Nyall Dawson 
Subject: [Qgis-user] Problem: Can't open Spatialite tables in QGIS on Windows

Hi,

We have been using QGIS & Spatialite for years and have recently encountered a 
problem in QGIS under Windows.

We connect to a spatialite database fine, we can list the tables, but when we 
try to open them we get an error:
db <...> table <...> is an invalid layer - not loaded (this is also written to 
the log)

I can open the db in DBManager and enter the query "select * from t_transect;" 
which runs & shows the data in the output pane.
When I try to load the layer as a map layer I get an error message referring me 
to the error log, but the log is empty.

This is using QGIS 3.34.1 on Windows.

The same database file works perfectly on Linux, with QGIS v3.34.3. A colleague 
has tried this & v3.36 on Windows with the same problem. The databases are 
generated with echo sounder data by the ESP3 application, and we have been able 
to use these in QGIS for years without problems until now.

Spatialite access the tables fine, the basic metadata is present:
select * from geometry_columns;
t_transect|geom_col|1|2|4326|0
t_echoint_transect_1d|geom_col|1|2|4326|0

The QGIS error message is not particularly helpful in determining the problem. 
Our workaround is to run the SQL we would have run in the QGIS database manager 
directly from the spatialite command line, exported to CSV & then open the CSV 
in QGIS, which works, but is not ideal.

For some context about these data:  The figure shows each "ping" from the echo 
sounder, scaled by the magnitude of the echo from fish, showing the location 
and density of fish encountered on each transect (ESP3 is used for the acoustic 
analysis). This dataset was from surveying a hill off the west coast of New 
Zealand (generated on Linux!).

[cid:d8335c55-7ad0-42bf-a514-c2ff56fc3815]
Brent Wood

Principal Technician, Fisheries
NIWA
DDI:  +64 (4) 3860529
[https://www.niwa.co.nz/static/niwa-2018-horizontal-180.png] 

Brent Wood
Principal Technician - GIS and Spatial Data Management
Programme Leader - Environmental Information Delivery
+64-4-386-0529

National Institute of Water & Atmospheric Research Ltd (NIWA)
301 Evans Bay Parade Hataitai Wellington New Zealand
Connect with NIWA: niwa.co.nz 
Facebook 
LinkedIn 
Twitter 
Instagram 
YouTube
To ensure compliance with legal requirements and to maintain cyber security 
standards, NIWA's IT systems are subject to ongoing monitoring, activity 
logging and auditing. This monitoring and auditing service may be provided by 
third parties. Such third parties can access information transmitted to, 
processed by and stored on NIWA's IT systems.
Note: This email is intended solely for the use of the addressee and may 
contain information that is confidential or subject to legal professional 
privilege. If you receive this email in error please immediately notify the 
sender and delete the email.
___
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