Re: [Qgis-user] QGIS customized importing apparently causes problems with type checkers/Intellisense

2021-12-15 Per discussione Richard Duivenvoorde

Hi Ari,

I'm not using VS Code so sorry, cannot give specific help.
But using Pycharm there also you need to take a lot of hoops to be able to use 
code-completion.
See for example:

https://qtibia.com/how-to-setup-pycharm-for-qgis-development-under-linux-and-windows/
and
https://silverspringenergy.com/using-pycharm-as-an-ide-for-qgis-3-plugin-development-2/

The crux is that the editors need to build up some internal structures with all 
(possible) types and names in it, so paths from libraries (like PyQGIS ones) 
which are not in the normal python path have to be manually added. AND because 
pyqgis is actually a wrapper around c++ libs you also have to point to those (I 
think because else they do not have enough information).
Also with PyCharm it is a lot of fiddling, but in the end it just works.

IF you manage to make it work: let's write it down somewhere!

Regards,

Richard Duivenvoorde

On 12/16/21 01:48, Ari Meyer wrote:

Hi,

We've been trying to use VS Code Python type checkers to reduce errors, and 
leverage Intellisense for code completion.  We've been unable to get these to 
work with PyQGIS and PyQT classes, for instance:

image.png

I believe I've traced the problem to some customized importing that's used in 
places like the following:
c:\OSGeo4W\apps\qgis-ltr\python\qgis\__init__.py
c:\OSGeo4W\apps\qgis-ltr\python\qgis\core\__init__.py
c:\OSGeo4W\apps\qgis-ltr\python\qgis\PyQt\Qt.py

I then found that apparently similar techniques have caused the same types of 
problems when using libraries like TensorFlow:
https://stackoverflow.com/questions/65271399/vs-code-pylance-pylint-cannot-resolve-import
 

https://github.com/PyCQA/pylint/issues/2603#issuecomment-541622729 


The convoluted ways suggested to deal with these problems aren't really that 
appealing.  Does anyone have any suggestions for cleaner ways to handle this?

Are there reasons why QGIS has to be implemented like this?  It's not clear from the 
"monkey patching" comments whether these were temporary workarounds or not.

Thanks,
Ari

___
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 customized importing apparently causes problems with type checkers/Intellisense

2021-12-15 Per discussione Ari Meyer
Hi,

We've been trying to use VS Code Python type checkers to reduce errors, and
leverage Intellisense for code completion.  We've been unable to get these
to work with PyQGIS and PyQT classes, for instance:

[image: image.png]

I believe I've traced the problem to some customized importing that's used
in places like the following:
c:\OSGeo4W\apps\qgis-ltr\python\qgis\__init__.py
c:\OSGeo4W\apps\qgis-ltr\python\qgis\core\__init__.py
c:\OSGeo4W\apps\qgis-ltr\python\qgis\PyQt\Qt.py

I then found that apparently similar techniques have caused the same types
of problems when using libraries like TensorFlow:
https://stackoverflow.com/questions/65271399/vs-code-pylance-pylint-cannot-resolve-import
https://github.com/PyCQA/pylint/issues/2603#issuecomment-541622729

The convoluted ways suggested to deal with these problems aren't really
that appealing.  Does anyone have any suggestions for cleaner ways to
handle this?

Are there reasons why QGIS has to be implemented like this?  It's not clear
from the "monkey patching" comments whether these were temporary
workarounds or not.

Thanks,
Ari
___
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] Buffer by Attribute Issue

2021-12-15 Per discussione chris hermansen
Peter and list,

On Wed, Dec 15, 2021 at 7:26 AM Peter Devanney  wrote:

> Hi Folks
>
> Have a table full of points that I want to buffer by a variable distance.
> The distance is an attribute in the input table in km.
>
> Using Vector>Geoprocessing>Buffer It works fine if I specify a fixed
> buffer.
>
> When I run it with the attribute selected it runs fine but it will not
> paint the buffers. At first I thought I had a unit issue so added an
> expression to multiply the attribute by 1000 to get to km from m as I
> wasn't sure if the default was m.
>
> The buffered output behaves totally normally so I can label, and zoom to
> features... All looks fine except no actual buffers draw. Symbology panel
> looks normal.
>
> Just wondering if anyone has seen this or knows of a workaround or
> thoughts on what I am doing wrong.
>
> What is the type of your buffer item?  What are the typical values?

What is your CRS?


-- 
Chris Hermansen · clhermansen "at" gmail "dot" com

C'est ma façon de parler.
___
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-it-user] errore nel collegamento di due algoritmi di processing nello stesso script

2021-12-15 Per discussione Giacomo Fontanelli
Salve, vi allego l'ultima parte di uno script python che dovrebbe
funzionare come algoritmo di processing.

In pratica dovrebbe compiere un'operazione matematica su ogni banda di un
multiband raster
e immediatamente creare un nuovo multiband raster in output con le bande
calcolate.
Lo script funziona, ma alla fine fornisce un errore, credo sia perchè qgis
sta cercando di caricare sulla canvas
ogni singola banda calcolata (e invece non dovrebbe, ma dovrebbe caricare
solo il multiband raster).

Credo di non aver capito molto bene ancora come si collegano due operazioni
di processing successive.

Riesco ad evitare il messaggio di errore solo se al momento dell'esecuzione
deflaggo l'opzione "Apri il risultato alla fine dell'algoritmo".

Sapete darmi qualche consiglio?

Grazie

bandList = []

# fa un loop tra le bande del raster
for band in range(1, nBand+1):

# svolge l'operazione matematica per ogni banda
outRas = processing.run(
'qgis:rastercalculator',
{"EXPRESSION": operation = "10 * ( log10 ( " + pathStackIn
+ "@" + str(band) + " ) )",
"LAYERS": stackIn,
"CELLSIZE": None,
"EXTENT": None,
"CRS": None,
"OUTPUT": "TEMPORARY_OUTPUT"},
is_child_algorithm = True,
context = context,
feedback = feedback)

bandList.append(outRas["OUTPUT"])

# crea il nuovo multiband raster con i layer calcolati
outStack = processing.run(
'gdal:merge',
 {"INPUT": bandList,
 "PCT": False,
 "SEPARATE": True,
 "NODATA_INPUT": None,
 "NODATA_OUTPUT": None,
 "OPTIONS":"",
 "EXTRA":"",
 "DATA_TYPE": 5,
 "OUTPUT": parameters[self.OUTPUT]}
 is_child_algorithm = True,
 context = context,
 feedback = feedback)

return {self.OUTPUT: outStack["OUTPUT"]}
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


Re: [Qgis-user] Buffer by Attribute Issue

2021-12-15 Per discussione Bernd Vogelgesang

Hi,

sorry, but can't reproduce your problem (but on Linux Mint QGIS 3.22).
Generated 100 random points and added a field "buffer" from $id*10.
Everything fine here.

Bernd

Am 15.12.21 um 16:26 schrieb Peter Devanney:

Hi Folks

Have a table full of points that I want to buffer by a variable
distance. The distance is an attribute in the input table in km.

Using Vector>Geoprocessing>Buffer It works fine if I specify a fixed
buffer.

When I run it with the attribute selected it runs fine but it will not
paint the buffers. At first I thought I had a unit issue so added an
expression to multiply the attribute by 1000 to get to km from m as I
wasn't sure if the default was m.

The buffered output behaves totally normally so I can label, and zoom
to features... All looks fine except no actual buffers draw. Symbology
panel looks normal.

Just wondering if anyone has seen this or knows of a workaround or
thoughts on what I am doing wrong.

I am running 3.16.8 Hannover on mac OS 11.6

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
___
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] Buffer by Attribute Issue

2021-12-15 Per discussione Peter Devanney
Hi Folks

Have a table full of points that I want to buffer by a variable distance.
The distance is an attribute in the input table in km.

Using Vector>Geoprocessing>Buffer It works fine if I specify a fixed buffer.

When I run it with the attribute selected it runs fine but it will not
paint the buffers. At first I thought I had a unit issue so added an
expression to multiply the attribute by 1000 to get to km from m as I
wasn't sure if the default was m.

The buffered output behaves totally normally so I can label, and zoom to
features... All looks fine except no actual buffers draw. Symbology panel
looks normal.

Just wondering if anyone has seen this or knows of a workaround or thoughts
on what I am doing wrong.

I am running 3.16.8 Hannover on mac OS 11.6

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] Change auto-selected column headers behaviour at delimited text import

2021-12-15 Per discussione Roland Spielhofer
Werner, you are totally right - compiling is beyond my capabilities.


Would be happy if you could do that, maybe it's useful for other users too.

 

Regards,

Roland

 

Gesendet: Mittwoch, 15. Dezember 2021 um 14:18 Uhr
Von: "Werner Macho" 
An: "Roland Spielhofer" 
Cc: "qgis-user" 
Betreff: Re: [Qgis-user] Change auto-selected column headers behaviour at delimited text import


PS: I maybe falsely assumed you are self compiling.
If you want I can try that today evening and maybe create a pull request for master.

 

regards

Werner

 


On Wed, Dec 15, 2021 at 2:13 PM Werner Macho  wrote:


Hi Roland,
 

without trying it my first guess would be that the file 

 

QGIS/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp

line number 587 has something to do with it ..

 

(trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "longitude" ), QStringLiteral( "latitude" ) );
  trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "lon" ), QStringLiteral( "lat" ) );
  trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "east" ), QStringLiteral( "north" ) );
  trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "x" ), QStringLiteral( "y" ) );
  trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "e" ), QStringLiteral( "n" ) );)
 
maybe give it a try.

 

regards

Werner


 


On Wed, Dec 15, 2021 at 2:00 PM Roland Spielhofer  wrote:




Hi,

when importing delimted text using the data source manager, QGIS automagically detects possible column headers that may hold geometry information - in the "Geometry definition" panel.

 

In my experience, if column names like "lat", "lon", "x" or "y" exist, QGIS automagically selects them for "X fIeld" and "Y field"

See also

https://imgur.com/a/CRKRKtT

where this part is highlighted.

 

I often have column names like "RW" (="Rechtswert") that hold the x coordinate and "HW" ("Hochwert") for the y cordinate. German speaking surveyors may be familiar with the terms...

 

Anyway, what I am looking for is how to extend the list of lat, lon, x, y, ... to make QGIS also senitive to my RW and HW column headers. Is there a way to customize that?

 

 

Regards,

Roland


___
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] Change auto-selected column headers behaviour at delimited text import

2021-12-15 Per discussione Werner Macho
PS: I maybe falsely assumed you are self compiling.
If you want I can try that today evening and maybe create a pull request
for master.

regards
Werner

On Wed, Dec 15, 2021 at 2:13 PM Werner Macho  wrote:

> Hi Roland,
>
> without trying it my first guess would be that the file
>
> QGIS/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
> line number 587 has something to do with it ..
>
> (trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "longitude"
> ), QStringLiteral( "latitude" ) );
>   trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "lon" ),
> QStringLiteral( "lat" ) );
>   trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "east" ),
> QStringLiteral( "north" ) );
>   trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "x" ),
> QStringLiteral( "y" ) );
>   trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "e" ),
> QStringLiteral( "n" ) );)
>
> maybe give it a try.
>
> regards
> Werner
>
> On Wed, Dec 15, 2021 at 2:00 PM Roland Spielhofer  wrote:
>
>> Hi,
>> when importing delimted text using the data source manager, QGIS
>> automagically detects possible column headers that may hold geometry
>> information - in the "Geometry definition" panel.
>>
>> In my experience, if column names like "lat", "lon", "x" or "y" exist,
>> QGIS automagically selects them for "X fIeld" and "Y field"
>> See also
>> https://imgur.com/a/CRKRKtT
>> where this part is highlighted.
>>
>> I often have column names like "RW" (="Rechtswert") that hold the x
>> coordinate and "HW" ("Hochwert") for the y cordinate. German speaking
>> surveyors may be familiar with the terms...
>>
>> Anyway, what I am looking for is how to extend the list of lat, lon, x,
>> y, ... to make QGIS also senitive to my RW and HW column headers. Is there
>> a way to customize that?
>>
>>
>> Regards,
>> Roland
>> ___
>> 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] Change auto-selected column headers behaviour at delimited text import

2021-12-15 Per discussione Werner Macho
Hi Roland,

without trying it my first guess would be that the file

QGIS/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
line number 587 has something to do with it ..

(trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "longitude"
), QStringLiteral( "latitude" ) );
  trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "lon" ),
QStringLiteral( "lat" ) );
  trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "east" ),
QStringLiteral( "north" ) );
  trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "x" ),
QStringLiteral( "y" ) );
  trySetXYField( fieldList, isValidCoordinate, QStringLiteral( "e" ),
QStringLiteral( "n" ) );)

maybe give it a try.

regards
Werner

On Wed, Dec 15, 2021 at 2:00 PM Roland Spielhofer  wrote:

> Hi,
> when importing delimted text using the data source manager, QGIS
> automagically detects possible column headers that may hold geometry
> information - in the "Geometry definition" panel.
>
> In my experience, if column names like "lat", "lon", "x" or "y" exist,
> QGIS automagically selects them for "X fIeld" and "Y field"
> See also
> https://imgur.com/a/CRKRKtT
> where this part is highlighted.
>
> I often have column names like "RW" (="Rechtswert") that hold the x
> coordinate and "HW" ("Hochwert") for the y cordinate. German speaking
> surveyors may be familiar with the terms...
>
> Anyway, what I am looking for is how to extend the list of lat, lon, x, y,
> ... to make QGIS also senitive to my RW and HW column headers. Is there a
> way to customize that?
>
>
> Regards,
> Roland
> ___
> 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] Change auto-selected column headers behaviour at delimited text import

2021-12-15 Per discussione Roland Spielhofer
Hi,

when importing delimted text using the data source manager, QGIS automagically detects possible column headers that may hold geometry information - in the "Geometry definition" panel.

 

In my experience, if column names like "lat", "lon", "x" or "y" exist, QGIS automagically selects them for "X fIeld" and "Y field"

See also

https://imgur.com/a/CRKRKtT

where this part is highlighted.

 

I often have column names like "RW" (="Rechtswert") that hold the x coordinate and "HW" ("Hochwert") for the y cordinate. German speaking surveyors may be familiar with the terms...

 

Anyway, what I am looking for is how to extend the list of lat, lon, x, y, ... to make QGIS also senitive to my RW and HW column headers. Is there a way to customize that?

 

 

Regards,

Roland
___
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 3.16 in mac error with translate raster file

2021-12-15 Per discussione Azzurra Lentini
Andrea Thanks a lot
All regards Azzurra


On Wed, 15 Dec 2021 at 13:06, Andrea Giudiceandrea 
wrote:

> Azzurra Lentini
> 
>  Tue, 14 Dec 2021 09:49:03 -0800
> 
>
> Hi to all, a student of mine has having this issues during a raster
> processing operation (translate). She is using a Qgis 3.16 in mac and she
> does not have problems with other raster file operations like slope, shade
> etc, but when she wants to transform a raster file  data type floats to
> raster file pixel data type Integer, using the command translate, she gets
> this error message: do you know what is? I am sure she does not have any
> symbols or empty spaces in the paths of her files.
>
>
> Hi Azzurra,
> the only algorithm for raster layers available in the processing toolbox
> whose name contains the word "translate" is the GDAL raster conversion
> algorithm "Translate (convert format)".
>
> Instead, the error reported in the log (is only one error repeated several
> times) is about a GRASS algorithm, not a GDAL algorithm.
>
> Anyway, if the algorithm used is a GRASS algorithm and the output layer
> CRS is EPSG:3857 "WGS 84 / Pseudo-Mercator", then this issue has been
> already reported for macOS and fixed in QGIS 3.22 but not fixed in QGIS
> 3.16.
> See https://github.com/qgis/QGIS/issues/41870 and
> https://github.com/qgis/QGIS/pull/45399
>
> Best regards.
>
> Andrea Giudiceandrea
>


-- 
Gis Expert for Environmental Science
Environmental Disasters, Hydrogeology, Climate
[image: image.png]
*Eur**opean **Commission*
*Joint Research Centre*
Adjunct Professor University "Roma Tre"
AZZURRA LENTINI
++
Italy Mobile Tel.: **(39) 338 24 40 676
++
SKYPE azzurrahydro
++

*azzurralent...@gmail.com *

*azzurra.lent...@uniroma3.it  *
++
*Par respect pour l'environnement,*
*n'imprimez ce mail qu'en cas d'absolue nécessité*
___
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.16 in mac error with translate raster file

2021-12-15 Per discussione Andrea Giudiceandrea
Azzurra Lentini 
Tue, 
14 Dec 2021 09:49:03 -0800 



Hi to all, a student of mine has having this issues during a raster
processing operation (translate). She is using a Qgis 3.16 in mac and she
does not have problems with other raster file operations like slope, shade
etc, but when she wants to transform a raster file  data type floats to
raster file pixel data type Integer, using the command translate, she gets
this error message: do you know what is? I am sure she does not have any
symbols or empty spaces in the paths of her files.


Hi Azzurra,
the only algorithm for raster layers available in the processing toolbox 
whose name contains the word "translate" is the GDAL raster conversion 
algorithm "Translate (convert format)".


Instead, the error reported in the log (is only one error repeated 
several times) is about a GRASS algorithm, not a GDAL algorithm.


Anyway, if the algorithm used is a GRASS algorithm and the output layer 
CRS is EPSG:3857 "WGS 84 / Pseudo-Mercator", then this issue has been 
already reported for macOS and fixed in QGIS 3.22 but not fixed in QGIS 
3.16.
See https://github.com/qgis/QGIS/issues/41870 and 
https://github.com/qgis/QGIS/pull/45399


Best regards.

Andrea Giudiceandrea___
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