Re: [QGIS-it-user] MagicWand in python Console

2023-04-26 Thread Giulio
Buongiorno
Non sono presenti e non vengono installati da osgeo, parrebbero mancare nel 
repositori
A presto
Giulio

⁣Ottieni BlueMail per Android ​

Il giorno 27 apr 2023, 00:58, alle ore 00:58, Andrea Giudiceandrea via 
QGIS-it-user  ha scritto:
>> Giulio Fattori giulio.fattori a tin.it
>> Gio 6 Apr 2023 22:20:13 PDT
>
>> al tentativo di usarla appare il messaggio /'The Python modules
>isort, 
>> autopep8 are missing'/
>>
>> ho tentato di installarli dal setup di osgeo ma senza risultato, pare
>
>> non siano disponibili.
>
>Ciao Giulio,
>non ho capito: i moduli python isort e autopep8 sono presenti ma non
>riesci ad installarli oppure non sono presenti?
>
>A presto.
>
>Andrea
>___
>QGIS-it-user mailing list
>QGIS-it-user@lists.osgeo.org
>https://lists.osgeo.org/mailman/listinfo/qgis-it-user
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


Re: [QGIS-it-user] MagicWand in python Console

2023-04-26 Thread Andrea Giudiceandrea via QGIS-it-user

Giulio Fattori giulio.fattori a tin.it
Gio 6 Apr 2023 22:20:13 PDT


al tentativo di usarla appare il messaggio /'The Python modules isort, 
autopep8 are missing'/


ho tentato di installarli dal setup di osgeo ma senza risultato, pare 
non siano disponibili.


Ciao Giulio,
non ho capito: i moduli python isort e autopep8 sono presenti ma non 
riesci ad installarli oppure non sono presenti?


A presto.

Andrea
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


Re: [Qgis-user] setting map scale

2023-04-26 Thread Andrea Giudiceandrea via QGIS-User

Lester Anderson arctica1963 at gmail.com
Wed Apr 26 08:29:04 PDT 2023



Not sure if this is a bug, but when trying to select the map scale from the
status bar (1) It is not expanded to see properly and (2) Clicking the down
button causes QGIS to crash.

Issue: Version 3.30.1



Hi Lester,
the bug that caused the crash has been reported several times [1] and 
has been already fixed after various attempts [2].


The fixes will land in the upcoming QGIS 3.30.2 release.

In the meantime, you can workaround the issue even in QGIS 3.30.1 by 
going to "Settings->Options..." -> "Map Tools" -> "Predefined Scales" 
and click on the "Reset to default scales" button in order to restore 
the predefined scales, populate the map scale listbox and avoid the crash.


Best regards.

Andrea


[1] see e.g. https://github.com/qgis/QGIS/issues/52383
[2] https://github.com/qgis/QGIS/pull/52427 , 
https://github.com/qgis/QGIS/pull/52414 , 
https://github.com/qgis/QGIS/pull/52511 , 
https://github.com/qgis/QGIS/pull/52580

___
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] New Earth, Sun, Moon, Planets QGIS Plugin

2023-04-26 Thread C Hamilton via QGIS-User
I developed most of this plugin some time ago, but have never liked
publishing a plugin that was not self contained meaning that it has no
depancies on other Python libraries not supplied by QGIS or data too large
to include.

Meet the Earth, Sun, Moon, and Planets plugin. For a particular date & time
it displays the location of the Sun, Moon, and planets where they would be
at their zenith, directly overhead as seen from the surface of the Earth.
It also has another tool that given a date, time, and coordinate it will
display solar and lunar information such as azimuth, elevation, twilights,
etc.

https://plugins.qgis.org/plugins/earthsunmoon/

This plugin requires two additional libraries to be installed. Open the
OSGeo4W Shell and install timezonefinder and skyfield.

pip install timezonefinder skyfield

I am in the process of passing the baton for my QGIS plugins to another
organization but wanted to get this released. The one algorithm I really
wanted to include was to generate an accurate day/night line or polygons
including different twilights. I never found an algorithm that I liked.
There are ones based on a spherical earth, but can be as much as 10 degrees
off towards the poles.

Anyway I hope you enjoy this plugin.

Best wishes,
Calvin
___
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] setting map scale

2023-04-26 Thread Stewart Holt via QGIS-User
Yes, I have seen that problem in 3.30.1. (I have not installed 3.30.0)
The problem exists even before opening a project. When I attempted to
create a new profile, QGIS became unresponsive. After a minute or so, I
killed the process, restarted QGIS, and the problem still existed. I think
it was using the new profile. To define what the symptom is in more
detail... All of the configured scales are listed horizontally in the
dropdown which is 8 or 10 inches wide. They are separated by commas and
highlighted blue. With a project open, I can type a scale into the box and
it correctly accepts it and uses it. This must not be a widespread problem,
but in ruling out the profile, I haven't thought of any other change to
try. I have continued to use 3.28 as a result.

Stewart

On Wed, Apr 26, 2023 at 11:31 AM Lester Anderson via QGIS-User <
qgis-user@lists.osgeo.org> wrote:

> Hello all,
>
> Not sure if this is a bug, but when trying to select the map scale from
> the status bar (1) It is not expanded to see properly and (2) Clicking the
> down button causes QGIS to crash.
>
> Issue: Version 3.30.1
>
> Anyone el;se see this problem?
>
> 3.26.3 Shows scale fine
> 3.30.1 Does not show scale properly
>
> Lester
>
>
> ___
> 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] PyQGIS to set masked symbol layer and mask source in ver. 3.30

2023-04-26 Thread Julien Cabieces via QGIS-User

Hi,

I changed the way we referenced symbol layer to make it more simple and
robust. Now, symbol layer have a generated unique id so it's easier to reference
each of them (instead of a path of indices in the symbol layers tree before).

I see 2 solutions here:

1. You keep your old references and call
QgsProjectFileTransform.fixOldSymbolLayerReferences() on your layers

2. You change the way you create the references. here[0] is an example on
how you can create QgsSymbolLayerReference. 

I would favor solution 2 because you wouldn't rely on deprecated method
and so you would be more future proof for when we eventually drop these
methods.

Regards,
Julien

[0] 
https://github.com/qgis/QGIS/pull/50786/files#diff-c7f779c945b0e9c401ddb964691ec0d6a07c6c3fcfca0e3db146f97aec2d17e2R177

> Thanks to the answer to this post 
> https://gis.stackexchange.com/questions/447362/pyqgis-to-set-masked-symbol-layer-and-mask-source
>
> I managed to set the mask layer in QGIS version 3.28.
>
>  
>
> The code is not working In ver. 3.30 due to a change in the 
> QgsSymbolLayerReference class.
>
> However I’m not able to change the original code so it fits with the new 
> specification
>
>  
>
> I just don’t understand how to set the input parameters to fulfil the 
> requirements in
> https://qgis.org/pyqgis/3.30/core/QgsSymbolLayerReference.html#qgis.core.QgsSymbolLayerReference
>
>  
>
> # Set masked symbol layers :  setMaskedSymbolLayers(self, maskedLayers: 
> Iterable[QgsSymbolLayerReference])
>
>  
>
> fileName = "./gpkg/karplantehoyder.gpkg"
>
> layer = QgsVectorLayer(fileName, "hoyder", "ogr")
>
> layer.loadNamedStyle('./qml/n5hoyder.qml')  # Load qml
>
> QgsProject.instance().addMapLayer(layer, False) # Add layer False to be able 
>
> root.insertLayer(4,layer)   # to specify a custom position
>
> label_settings = layer.labeling().settings()# Get current settings of the 
> layer
>
> text_format = label_settings.format()   # Get text format of the 
> settings
>
>  
>
> # old code (working in 3.28)
>
> # 
> text_format.mask().setMaskedSymbolLayers([QgsSymbolLayerReference(layer.id(), 
> QgsSymbolLayerId("", 0))])  # set masked symbol layers *
>
>  
>
> # -- New code
>
> linesymbol = QgsLineSymbol()
>
> lyr = linesymbol.symbolLayer(0) # Trying to get the id of the 
> line layer (hoyder)
>
> text_format.mask().setMaskedSymbolLayers([layer.id(), lyr.id()])  # set 
> masked symbol layers – not working
>
> # --
>
>  
>
> label_settings.setFormat(text_format)   # set format
>
> layer.labeling().setSettings(label_settings)# set settings
>
> layer.saveStyleToDatabase(layer.name(),'style n5hoyder',True,'')  # Save 
> style in gpkg
>
>  
>
> Anyone who knows how I should write the code marked with *?
>
>  
>
> Kind regards
>
> Anne
>
> ___
> 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


-- 

Julien Cabieces
Senior Developer at Oslandia
julien.cabie...@oslandia.com
09.72.52.52.76
___
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] Pyqgis how to append existing gpkg layer

2023-04-26 Thread andrea antonello via QGIS-User
Hi German,


> that's right Andrea. It actually depends on whether you want to append
> features to an existing layer, or to "append" (one could also say "create")
> a layer (in)to an existing GPKG database. The latter case is well covered
> by Anne's answer.
>
> See prior messages in this thread:
> https://lists.osgeo.org/pipermail/qgis-user/2023-April/052855.html
>

ah, sorry, I missed that part somehow.
Thanks, cheers,
Andrea



>
> Regards,
>
> Germán
>
>
> El mié, 26 abr 2023 a las 9:11, andrea antonello via QGIS-User (<
> qgis-user@lists.osgeo.org>) escribió:
>
>> Hi, from what I saw in the docs, you should be able to append to layers
>> with the filewriter option AppendToLayerNoNewFields?
>> The CreateOrOverwriteLayer overwrites the layer completely.
>>
>> Cheers,
>> Andrea
>>
>>
>> On Wed, Apr 26, 2023 at 2:58 PM Anne B. Nilsen via QGIS-User <
>> qgis-user@lists.osgeo.org> wrote:
>>
>>> I’m not a pyQGIS-expert, but with help from gis.stackechange.com I have
>>> managed to create an empty geopackage file and then adding several layers
>>> to it with this code:
>>>
>>> …
>>>
>>> gpkg_reg = "karplanteregistrering.gpkg"   # the NEW gpkg
>>> to be created
>>>
>>> if os.path.exists(gpkg_reg):  # If gpkg-file
>>> already exists, delete it
>>>
>>> os.remove(gpkg_reg)
>>>
>>> …
>>>
>>> #
>>> https://gis.stackexchange.com/questions/417916/creating-empty-layers-in-a-geopackage-using-pyqgis?noredirect=1=1
>>>
>>> def create_blank_gpkg_layer(gpkg_path: str, layer_name: str, geometry:
>>> int,
>>>
>>> crs: str, fields: QgsFields, append: bool =
>>> False
>>>
>>> ) -> bool:
>>>
>>> # To add a layer to an existing GPKG file, pass 'append' as True
>>>
>>> options = QgsVectorFileWriter.SaveVectorOptions()
>>>
>>> options.driverName = "GPKG"
>>>
>>> options.layerName = layer_name
>>>
>>> if append:
>>>
>>> options.actionOnExistingFile =
>>> QgsVectorFileWriter.CreateOrOverwriteLayer
>>>
>>> writer = QgsVectorFileWriter.create(
>>>
>>> gpkg_path,
>>>
>>> fields,
>>>
>>> geometry,
>>>
>>> QgsCoordinateReferenceSystem(crs),
>>>
>>> QgsCoordinateTransformContext(),
>>>
>>> options)
>>>
>>> del writer
>>>
>>> return True
>>>
>>> …
>>>
>>> # Layer 1 oversikt – creating an empty layer with attributes read from a
>>> csv-file
>>>
>>> f = open("./egenskaper/egenskaper_oversikt.csv",'r') # open file
>>>
>>> f.readline()  # read the first line of the file (the "metadata"/heading)
>>>
>>> layer_name = "oversikt"  # set layer name
>>>
>>> print('creates layer', layer_name)   # print layer name
>>>
>>> geom = QgsWkbTypes.PointZ# geometrytype
>>>
>>> crs = 'epsg:25832'   # coordinate system
>>>
>>> fields = QgsFields()
>>>
>>> for line in f:   # Read attrubutes from csv-file
>>>
>>>  r = {}
>>>
>>>  r = line.split(';')  # 0 navn, 1 QVariant-type, 2 lengde og 3
>>> presisjon
>>>
>>>  fname = r[0]
>>>
>>>  l = int(r[2])
>>>
>>>  p = int(r[3])
>>>
>>>  try:
>>>
>>>   fields.append(QgsField(fname,set_variant(r[1]),'',l,p))  # add
>>> field to layer
>>>
>>>  except:
>>>
>>>   print("Noe gikk galt - får ikke laget egenskaper fra " +str(f))
>>>
>>> f.close()  # close file
>>>
>>> create_blank_gpkg_layer(gpkg_reg, layer_name, geom, crs, fields)  # Do
>>> NOT include True when the FIRST layer is created
>>>
>>>
>>>
>>> # Layer 2 arter (to be added to the same new gpkg-file just created
>>> above)
>>>
>>> f = open("./egenskaper/egenskaper_arter.csv",'r') # open file
>>>
>>> f.readline()
>>>
>>> layer_name = "arter"
>>>
>>> print('creates layer', layer_name)   # print layer name
>>>
>>> geom = QgsWkbTypes.PointZ# geometrytype
>>>
>>> crs = 'epsg:25832'   # coordinate system
>>>
>>> fields = QgsFields()
>>>
>>> for line in f:   # Read attrubutes from csv-file
>>>
>>>  r = {}
>>>
>>>  r = line.split(';')  # 0 navn, 1 QVariant-type, 2 lengde og 3
>>> presisjon
>>>
>>>  fname = r[0]
>>>
>>>  l = int(r[2])
>>>
>>>  p = int(r[3])
>>>
>>>  try:
>>>
>>>   fields.append(QgsField(fname,set_variant(r[1]),'',l,p))  # add
>>> field to layer
>>>
>>>  except:
>>>
>>>   print("Noe gikk galt - får ikke laget egenskaper fra " +str(f))
>>>
>>> f.close()  # close file
>>>
>>> create_blank_gpkg_layer(gpkg_reg, layer_name, geom, crs, fields, True)
>>> # Include True to add a new layer to the SAME gpkg-file
>>>
>>> …
>>>
>>>
>>>
>>> Note the difference in the use of True and not when calling
>>> create_blank_gpk_layer().
>>>
>>> Perhaps something similar may be the solution to your problem.
>>>
>>>
>>>
>>> Kind regards
>>>
>>> Anne
>>>
>>>
>>>
>>>
>>> ___
>>> QGIS-User mailing list
>>> QGIS-User@lists.osgeo.org
>>> List info: 

[Qgis-user] setting map scale

2023-04-26 Thread Lester Anderson via QGIS-User
Hello all,

Not sure if this is a bug, but when trying to select the map scale from the
status bar (1) It is not expanded to see properly and (2) Clicking the down
button causes QGIS to crash.

Issue: Version 3.30.1

Anyone el;se see this problem?

3.26.3 Shows scale fine
3.30.1 Does not show scale properly

Lester
___
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] Pyqgis how to append existing gpkg layer

2023-04-26 Thread Germán Carrillo via QGIS-User
Hi all,

that's right Andrea. It actually depends on whether you want to append
features to an existing layer, or to "append" (one could also say "create")
a layer (in)to an existing GPKG database. The latter case is well covered
by Anne's answer.

See prior messages in this thread:
https://lists.osgeo.org/pipermail/qgis-user/2023-April/052855.html

Regards,

Germán


El mié, 26 abr 2023 a las 9:11, andrea antonello via QGIS-User (<
qgis-user@lists.osgeo.org>) escribió:

> Hi, from what I saw in the docs, you should be able to append to layers
> with the filewriter option AppendToLayerNoNewFields?
> The CreateOrOverwriteLayer overwrites the layer completely.
>
> Cheers,
> Andrea
>
>
> On Wed, Apr 26, 2023 at 2:58 PM Anne B. Nilsen via QGIS-User <
> qgis-user@lists.osgeo.org> wrote:
>
>> I’m not a pyQGIS-expert, but with help from gis.stackechange.com I have
>> managed to create an empty geopackage file and then adding several layers
>> to it with this code:
>>
>> …
>>
>> gpkg_reg = "karplanteregistrering.gpkg"   # the NEW gpkg
>> to be created
>>
>> if os.path.exists(gpkg_reg):  # If gpkg-file
>> already exists, delete it
>>
>> os.remove(gpkg_reg)
>>
>> …
>>
>> #
>> https://gis.stackexchange.com/questions/417916/creating-empty-layers-in-a-geopackage-using-pyqgis?noredirect=1=1
>>
>> def create_blank_gpkg_layer(gpkg_path: str, layer_name: str, geometry:
>> int,
>>
>> crs: str, fields: QgsFields, append: bool =
>> False
>>
>> ) -> bool:
>>
>> # To add a layer to an existing GPKG file, pass 'append' as True
>>
>> options = QgsVectorFileWriter.SaveVectorOptions()
>>
>> options.driverName = "GPKG"
>>
>> options.layerName = layer_name
>>
>> if append:
>>
>> options.actionOnExistingFile =
>> QgsVectorFileWriter.CreateOrOverwriteLayer
>>
>> writer = QgsVectorFileWriter.create(
>>
>> gpkg_path,
>>
>> fields,
>>
>> geometry,
>>
>> QgsCoordinateReferenceSystem(crs),
>>
>> QgsCoordinateTransformContext(),
>>
>> options)
>>
>> del writer
>>
>> return True
>>
>> …
>>
>> # Layer 1 oversikt – creating an empty layer with attributes read from a
>> csv-file
>>
>> f = open("./egenskaper/egenskaper_oversikt.csv",'r') # open file
>>
>> f.readline()  # read the first line of the file (the "metadata"/heading)
>>
>> layer_name = "oversikt"  # set layer name
>>
>> print('creates layer', layer_name)   # print layer name
>>
>> geom = QgsWkbTypes.PointZ# geometrytype
>>
>> crs = 'epsg:25832'   # coordinate system
>>
>> fields = QgsFields()
>>
>> for line in f:   # Read attrubutes from csv-file
>>
>>  r = {}
>>
>>  r = line.split(';')  # 0 navn, 1 QVariant-type, 2 lengde og 3
>> presisjon
>>
>>  fname = r[0]
>>
>>  l = int(r[2])
>>
>>  p = int(r[3])
>>
>>  try:
>>
>>   fields.append(QgsField(fname,set_variant(r[1]),'',l,p))  # add
>> field to layer
>>
>>  except:
>>
>>   print("Noe gikk galt - får ikke laget egenskaper fra " +str(f))
>>
>> f.close()  # close file
>>
>> create_blank_gpkg_layer(gpkg_reg, layer_name, geom, crs, fields)  # Do
>> NOT include True when the FIRST layer is created
>>
>>
>>
>> # Layer 2 arter (to be added to the same new gpkg-file just created above)
>>
>> f = open("./egenskaper/egenskaper_arter.csv",'r') # open file
>>
>> f.readline()
>>
>> layer_name = "arter"
>>
>> print('creates layer', layer_name)   # print layer name
>>
>> geom = QgsWkbTypes.PointZ# geometrytype
>>
>> crs = 'epsg:25832'   # coordinate system
>>
>> fields = QgsFields()
>>
>> for line in f:   # Read attrubutes from csv-file
>>
>>  r = {}
>>
>>  r = line.split(';')  # 0 navn, 1 QVariant-type, 2 lengde og 3
>> presisjon
>>
>>  fname = r[0]
>>
>>  l = int(r[2])
>>
>>  p = int(r[3])
>>
>>  try:
>>
>>   fields.append(QgsField(fname,set_variant(r[1]),'',l,p))  # add
>> field to layer
>>
>>  except:
>>
>>   print("Noe gikk galt - får ikke laget egenskaper fra " +str(f))
>>
>> f.close()  # close file
>>
>> create_blank_gpkg_layer(gpkg_reg, layer_name, geom, crs, fields, True)  #
>> Include True to add a new layer to the SAME gpkg-file
>>
>> …
>>
>>
>>
>> Note the difference in the use of True and not when calling
>> create_blank_gpk_layer().
>>
>> Perhaps something similar may be the solution to your problem.
>>
>>
>>
>> Kind regards
>>
>> Anne
>>
>>
>>
>>
>> ___
>> 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
> 

Re: [Qgis-user] [Qgis-psc] New community voting member

2023-04-26 Thread Fernando M. Roxo da Motta via QGIS-User
On Mon, 24 Apr 2023 15:16:54 -0100, Adelcides Varela via QGIS-User
 wrote:


> Official name is República de Cabo Verde, mostly known as Cape Verde.

  Obrigado pelas suas contribuições Adelcides e seja muito bem vindo.

  Grande abraço.

> 
> Matthias Kuhn  escreveu no dia segunda,
> 24/04/2023 à(s) 15:00:
> 
> > Welcome Adelcides, a pleasure to have you on board!
> >
> > Out of curiosity, which nation is that ?
> >
> > Best regards
> > Matthias
> >
> > On Mon, Apr 24, 2023 at 5:51 PM Adelcides Varela via QGIS-PSC <
> > qgis-...@lists.osgeo.org> wrote:
> >  
> >> It is with a great pleasure and sense of recognition that I
> >> receive this special honour, particularly coming from a small
> >> african island nation with a population under half a million.
> >>
> >> I hope with the help of all the community I will be able to do a
> >> good job.
> >>
> >> Best regards,
> >> Adelcides Varela.
> >>
> >> Marco Bernasocchi via QGIS-User 
> >> escreveu no dia segunda, 24/04/2023 à(s) 11:22:
> >>  
> >>> Dear community,
> >>> I'd like you to join me in welcoming Adelcides Varela as our
> >>> newest community voting member.
> >>>
> >>> Adelcides is one of the admins of the QGIS Community - Official
> >>> Virtual Group (which has almost 60K members) and has been key in
> >>> helping various African QGIS communities.
> >>>
> >>> Thanks a lot, Adelcides for all you do and welcome!
> >>>
> >>> Please note that Adelcides was selected without the need for a
> >>> ballot since he was the only candidate proposed by the community.
> >>>
> >>> Cheers Marco
> >>>
> >>> --
> >>> Marco Bernasocchi
> >>>
> >>> QGIS.org Chair
> >>> OPENGIS.ch CEO
> >>> http://berna.io
> >>> ___
> >>> 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-PSC mailing list
> >> qgis-...@lists.osgeo.org
> >> https://lists.osgeo.org/mailman/listinfo/qgis-psc
> >>  
> >
> > [image:
> > https://www.opengis.ch/2022/11/03/best-of-swiss-enterprise-app-award-for-qfield/]
> > 
> > Best of Swiss Enterprise App-Award for QField
> > 
> > - Hold the power of QGIS in your hand - get it now
> >  








  Roxo

-- 
 Non luctari, ludare ---+ WYSIWYG
Fernando M. Roxo da Motta   | Editor?
Except where explicitly stated I speak on my own behalf.|  VI !!
PU5RXO | PX5Q6048   | I see text,
 Quis custodiet ipsos custodes?-+ I get text!
 
___
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] Pyqgis how to append existing gpkg layer

2023-04-26 Thread andrea antonello via QGIS-User
Hi, from what I saw in the docs, you should be able to append to layers
with the filewriter option AppendToLayerNoNewFields?
The CreateOrOverwriteLayer overwrites the layer completely.

Cheers,
Andrea


On Wed, Apr 26, 2023 at 2:58 PM Anne B. Nilsen via QGIS-User <
qgis-user@lists.osgeo.org> wrote:

> I’m not a pyQGIS-expert, but with help from gis.stackechange.com I have
> managed to create an empty geopackage file and then adding several layers
> to it with this code:
>
> …
>
> gpkg_reg = "karplanteregistrering.gpkg"   # the NEW gpkg
> to be created
>
> if os.path.exists(gpkg_reg):  # If gpkg-file
> already exists, delete it
>
> os.remove(gpkg_reg)
>
> …
>
> #
> https://gis.stackexchange.com/questions/417916/creating-empty-layers-in-a-geopackage-using-pyqgis?noredirect=1=1
>
> def create_blank_gpkg_layer(gpkg_path: str, layer_name: str, geometry: int,
>
> crs: str, fields: QgsFields, append: bool =
> False
>
> ) -> bool:
>
> # To add a layer to an existing GPKG file, pass 'append' as True
>
> options = QgsVectorFileWriter.SaveVectorOptions()
>
> options.driverName = "GPKG"
>
> options.layerName = layer_name
>
> if append:
>
> options.actionOnExistingFile =
> QgsVectorFileWriter.CreateOrOverwriteLayer
>
> writer = QgsVectorFileWriter.create(
>
> gpkg_path,
>
> fields,
>
> geometry,
>
> QgsCoordinateReferenceSystem(crs),
>
> QgsCoordinateTransformContext(),
>
> options)
>
> del writer
>
> return True
>
> …
>
> # Layer 1 oversikt – creating an empty layer with attributes read from a
> csv-file
>
> f = open("./egenskaper/egenskaper_oversikt.csv",'r') # open file
>
> f.readline()  # read the first line of the file (the "metadata"/heading)
>
> layer_name = "oversikt"  # set layer name
>
> print('creates layer', layer_name)   # print layer name
>
> geom = QgsWkbTypes.PointZ# geometrytype
>
> crs = 'epsg:25832'   # coordinate system
>
> fields = QgsFields()
>
> for line in f:   # Read attrubutes from csv-file
>
>  r = {}
>
>  r = line.split(';')  # 0 navn, 1 QVariant-type, 2 lengde og 3
> presisjon
>
>  fname = r[0]
>
>  l = int(r[2])
>
>  p = int(r[3])
>
>  try:
>
>   fields.append(QgsField(fname,set_variant(r[1]),'',l,p))  # add
> field to layer
>
>  except:
>
>   print("Noe gikk galt - får ikke laget egenskaper fra " +str(f))
>
> f.close()  # close file
>
> create_blank_gpkg_layer(gpkg_reg, layer_name, geom, crs, fields)  # Do NOT
> include True when the FIRST layer is created
>
>
>
> # Layer 2 arter (to be added to the same new gpkg-file just created above)
>
> f = open("./egenskaper/egenskaper_arter.csv",'r') # open file
>
> f.readline()
>
> layer_name = "arter"
>
> print('creates layer', layer_name)   # print layer name
>
> geom = QgsWkbTypes.PointZ# geometrytype
>
> crs = 'epsg:25832'   # coordinate system
>
> fields = QgsFields()
>
> for line in f:   # Read attrubutes from csv-file
>
>  r = {}
>
>  r = line.split(';')  # 0 navn, 1 QVariant-type, 2 lengde og 3
> presisjon
>
>  fname = r[0]
>
>  l = int(r[2])
>
>  p = int(r[3])
>
>  try:
>
>   fields.append(QgsField(fname,set_variant(r[1]),'',l,p))  # add
> field to layer
>
>  except:
>
>   print("Noe gikk galt - får ikke laget egenskaper fra " +str(f))
>
> f.close()  # close file
>
> create_blank_gpkg_layer(gpkg_reg, layer_name, geom, crs, fields, True)  #
> Include True to add a new layer to the SAME gpkg-file
>
> …
>
>
>
> Note the difference in the use of True and not when calling
> create_blank_gpk_layer().
>
> Perhaps something similar may be the solution to your problem.
>
>
>
> Kind regards
>
> Anne
>
>
>
>
> ___
> 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] Pyqgis how to append existing gpkg layer

2023-04-26 Thread Anne B. Nilsen via QGIS-User
Sorry, an error in the code in the previous answer.
Correct code is (writer should be without indentation):
...
def create_blank_gpkg_layer(gpkg_path: str, layer_name: str, geometry: int,
crs: str, fields: QgsFields, append: bool = False
) -> bool:
# To add a layer to an existing GPKG file, pass 'append' as True
options = QgsVectorFileWriter.SaveVectorOptions()
options.driverName = "GPKG"
options.layerName = layer_name
if append:
options.actionOnExistingFile = 
QgsVectorFileWriter.CreateOrOverwriteLayer
writer = QgsVectorFileWriter.create(
gpkg_path,
fields,
geometry,
QgsCoordinateReferenceSystem(crs),
QgsCoordinateTransformContext(),
options)
del writer
return True
...

Kind regards
Anne
___
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] Pyqgis how to append existing gpkg layer

2023-04-26 Thread Anne B. Nilsen via QGIS-User
I'm not a pyQGIS-expert, but with help from gis.stackechange.com I have managed 
to create an empty geopackage file and then adding several layers to it with 
this code:
...
gpkg_reg = "karplanteregistrering.gpkg"   # the NEW gpkg to be 
created
if os.path.exists(gpkg_reg):  # If gpkg-file 
already exists, delete it
os.remove(gpkg_reg)
...
# 
https://gis.stackexchange.com/questions/417916/creating-empty-layers-in-a-geopackage-using-pyqgis?noredirect=1=1
def create_blank_gpkg_layer(gpkg_path: str, layer_name: str, geometry: int,
crs: str, fields: QgsFields, append: bool = False
) -> bool:
# To add a layer to an existing GPKG file, pass 'append' as True
options = QgsVectorFileWriter.SaveVectorOptions()
options.driverName = "GPKG"
options.layerName = layer_name
if append:
options.actionOnExistingFile = 
QgsVectorFileWriter.CreateOrOverwriteLayer
writer = QgsVectorFileWriter.create(
gpkg_path,
fields,
geometry,
QgsCoordinateReferenceSystem(crs),
QgsCoordinateTransformContext(),
options)
del writer
return True
...
# Layer 1 oversikt - creating an empty layer with attributes read from a 
csv-file
f = open("./egenskaper/egenskaper_oversikt.csv",'r') # open file
f.readline()  # read the first line of the file (the "metadata"/heading)
layer_name = "oversikt"  # set layer name
print('creates layer', layer_name)   # print layer name
geom = QgsWkbTypes.PointZ# geometrytype
crs = 'epsg:25832'   # coordinate system
fields = QgsFields()
for line in f:   # Read attrubutes from csv-file
 r = {}
 r = line.split(';')  # 0 navn, 1 QVariant-type, 2 lengde og 3 presisjon
 fname = r[0]
 l = int(r[2])
 p = int(r[3])
 try:
  fields.append(QgsField(fname,set_variant(r[1]),'',l,p))  # add field 
to layer
 except:
  print("Noe gikk galt - får ikke laget egenskaper fra " +str(f))
f.close()  # close file
create_blank_gpkg_layer(gpkg_reg, layer_name, geom, crs, fields)  # Do NOT 
include True when the FIRST layer is created

# Layer 2 arter (to be added to the same new gpkg-file just created above)
f = open("./egenskaper/egenskaper_arter.csv",'r') # open file
f.readline()
layer_name = "arter"
print('creates layer', layer_name)   # print layer name
geom = QgsWkbTypes.PointZ# geometrytype
crs = 'epsg:25832'   # coordinate system
fields = QgsFields()
for line in f:   # Read attrubutes from csv-file
 r = {}
 r = line.split(';')  # 0 navn, 1 QVariant-type, 2 lengde og 3 presisjon
 fname = r[0]
 l = int(r[2])
 p = int(r[3])
 try:
  fields.append(QgsField(fname,set_variant(r[1]),'',l,p))  # add field 
to layer
 except:
  print("Noe gikk galt - får ikke laget egenskaper fra " +str(f))
f.close()  # close file
create_blank_gpkg_layer(gpkg_reg, layer_name, geom, crs, fields, True)  # 
Include True to add a new layer to the SAME gpkg-file
...

Note the difference in the use of True and not when calling 
create_blank_gpk_layer().
Perhaps something similar may be the solution to your problem.

Kind regards
Anne


___
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-it-user] R: Trasparenza layer

2023-04-26 Thread Ernesto Sferlazza
Prova anche ad utilizzare la modalità di fusione "moltiplica", valida sia
per layer vettoriali che raster:

Proprietà Layer -> Simbologia -> Visualizzazione Layer -> Modalità
fusione -> Moltiplica

Il giorno mar 25 apr 2023 alle ore 21:04 Stefano D. 
ha scritto:

> Salve,
>
> certo che esiste. Proprietà del layer vettoriale -> simbologia -> opacità
>
> Saluti
>
> Stefano.
>
>
>
> *Da: *Franco Cazzola 
> *Inviato: *martedì 25 aprile 2023 20:02
> *A: *qgis-it-user@lists.osgeo.org
> *Oggetto: *[QGIS-it-user] Trasparenza layer
>
>
>
> Buongiorno
>
> Uso uno sfondo raster (Esri standard) di una città nel quale i nomi delle
> strade sono in posizione centrale della strada stessa.
>
> Sopra il raster, visualizzo un layer vettoriale di linee, centrato sulla
> stessa strada e di spessore in base a delle Regole , che copre il nome
> della via.
>
> Mi piacerebbe se ci fosse la funzoone di trasparenza del layer vettoriale.
>
> Ho cercato tra le proprietà del layer vettoriale, na non ho trovato
> nessuna funzione di trasparenza.
>
> Esiste ??
>
>
>
> Versione
>
> Qgis 3.26 su windows 11
>
>
>
> Grazie
>
> Franco Cazzola
>
>
>
>
>
>
>
>
>
> Inviato dal mio Galaxy
>
>
>
>
> ___
> QGIS-it-user mailing list
> QGIS-it-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/qgis-it-user
>
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


[Qgis-user] PyQGIS to set masked symbol layer and mask source in ver. 3.30

2023-04-26 Thread Anne B. Nilsen via QGIS-User
Thanks to the answer to this post 
https://gis.stackexchange.com/questions/447362/pyqgis-to-set-masked-symbol-layer-and-mask-source
I managed to set the mask layer in QGIS version 3.28.

The code is not working In ver. 3.30 due to a change in the 
QgsSymbolLayerReference class.
However I'm not able to change the original code so it fits with the new 
specification

I just don't understand how to set the input parameters to fulfil the 
requirements in 
https://qgis.org/pyqgis/3.30/core/QgsSymbolLayerReference.html#qgis.core.QgsSymbolLayerReference

# Set masked symbol layers :  setMaskedSymbolLayers(self, maskedLayers: 
Iterable[QgsSymbolLayerReference])

fileName = "./gpkg/karplantehoyder.gpkg"
layer = QgsVectorLayer(fileName, "hoyder", "ogr")
layer.loadNamedStyle('./qml/n5hoyder.qml')  # Load qml
QgsProject.instance().addMapLayer(layer, False) # Add layer False to be able
root.insertLayer(4,layer)   # to specify a custom position
label_settings = layer.labeling().settings()# Get current settings of the 
layer
text_format = label_settings.format()   # Get text format of the 
settings

# old code (working in 3.28)
# text_format.mask().setMaskedSymbolLayers([QgsSymbolLayerReference(layer.id(), 
QgsSymbolLayerId("", 0))])  # set masked symbol layers *

# -- New code
linesymbol = QgsLineSymbol()
lyr = linesymbol.symbolLayer(0) # Trying to get the id of the 
line layer (hoyder)
text_format.mask().setMaskedSymbolLayers([layer.id(), lyr.id()])  # set masked 
symbol layers - not working
# --

label_settings.setFormat(text_format)   # set format
layer.labeling().setSettings(label_settings)# set settings
layer.saveStyleToDatabase(layer.name(),'style n5hoyder',True,'')  # Save style 
in gpkg

Anyone who knows how I should write the code marked with *?

Kind regards
Anne
___
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-it-user] Cancellazione console

2023-04-26 Thread Giulio Fattori

Il 26/04/2023 08:37, Andrea Giudiceandrea via QGIS-it-user ha scritto:

Il 06/04/2023 21:16, Andrea Giudiceandrea ha scritto:

Il 06/04/2023 19:49, Giulio Fattori ha scritto:

che codice occorre per cancellare la console da pyqgis?


Ciao Giulio,
questo dovrebbe fare al caso tuo...

from console import console
console._console.console.shellOut.clearConsole()


Ciao Giulio,
hai risolto il problema?

A presto.

Andrea
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


Certamente, grazie infinite

A presto

Giulio
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


Re: [Qgis-user] Problems with installation QGIS Server 3.28.5 on Ubuntu 22.04.

2023-04-26 Thread G. Wagner, Wagner-IT via QGIS-User
Hi,

the problem is probably due to the fact that the Hetzner cloud servers have an 
"arm64" or "aarch64" architecture. And these do not support the QGIS packages.

Is the support planned in the future?

Günter

___
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] self-learning resources

2023-04-26 Thread Ujaval Gandhi via QGIS-User
Hi Simon,I have a series of beginner-friendly tutorials in multiple languages at https://www.qgistutorials.com/. There's also several full-length courses at https://courses.spatialthoughts.com/---Ujaval GandhiSpatial Thoughtswww.spatialthoughts.comOn Wed, Apr 26, 2023 at 3:59 AM Phil Wyatt via QGIS-User  wrote:Hi Simon,For QGIS I always recommend Locate Press, Discover QGIS 3.0 as it exposes just about everything that folks will come across in early GIS career, plus it has useful exercises and data packages to download.Discover QGIS 3.x Book - Second Edition by Kurt Menkelocatepress.comCheers - Phil, On the road with his iPad On 26 Apr 2023, at 12:20 am, Simon Dietmann via QGIS-User  wrote:







dear group,
 
last week I was asked for a recommendation for resources for self-teaching by an almost complete GIS beginner. Of course I have some ideas, but does anyone of you have the ultimate hint for a good and systematic start
 into GIS in general and/or QGIS ?
 
cheers,
 
Simon
 

i.A. Simon DietmannProjektleiter | Geograph

PGNU Planungsgesellschaft Natur & Umwelt mbHAmtsgericht Frankfurt am Main, HRB 111938; Geschäftsführer: Dr. Benjamin Hill, Johannes Christoph Kress, Alexander von KüchlerHamburger Allee 45 +++ 60486 Frankfurt am MainDurchwahl: +49 69 952964-75 +++ Fax: +49 69 952964-99 +++ Mobil: E-Mail: dietm...@pgnu.de +++ Web: www.pgnu.de> Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

___QGIS-User mailing listQGIS-User@lists.osgeo.orgList info: https://lists.osgeo.org/mailman/listinfo/qgis-userUnsubscribe: 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 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] Opening GEOTIFF file in QGIS support request

2023-04-26 Thread Richard McDonnell via QGIS-User
Hi Gino,
Just to echo what Richard Duienvoorde said, QGIS should handle GeoTIFF 
perfectly fine. I use the format myself when working with raster's in QGIS.
First question's I would ask would be:

1)Are you getting any error messages when you load the Raster? What are they??
2)Is the Raster appearing in the Layer Panel?
3)Have you tried Dragging and dropping the Raster onto the Map Canvas?
4) As have a look at the Layer Properties, under Information. Look to see the 
rasters CRS, if its correct. Sometimes, the CRS isn't imbedded, resulting in it 
being displayed incorrectly.

If you, as Richard said could share any information about the raster with us, 
we could be of more help. As it is we have little to go on.
Kind Regards,

Richard






——
Richard McDonnell MSc GIS, FME Certified Professional
FRM Data Management

——
Oifig na nOibreacha Poiblí
Office of Public Works

Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
——
M +353 87 688 5964   T +353 46 942 2409
https://gov.ie/opw

——
To send me files larger than 30MB, please use the link below 
https://filetransfer.opw.ie/filedrop/richard.mcdonn...@opw.ie

Email Disclaimer: 
https://www.gov.ie/en/organisation-information/439daf-email-disclaimer/



——
Richard McDonnell MSc GIS, FME Certified Professional
FRM Data Management

——
Oifig na nOibreacha Poiblí
Office of Public Works

Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
——
M +353 87 688 5964   T +353 46 942 2409
https://www.opw.ie

——
To send me files larger than 30MB, please use the link below 
https://filetransfer.opw.ie/filedrop/richard.mcdonn...@opw.ie

Email Disclaimer: https://www.opw.ie/en/disclaimer/
> -Original Message-
> From: QGIS-User  On Behalf Of Richard
> Duivenvoorde via QGIS-User
> Sent: 26 April 2023 03:45
> To: qgis-user@lists.osgeo.org
> Cc: Qgis-user@lists.osgeo.org
> Subject: Re: [Qgis-user] Opening GEOTIFF file in QGIS support request
>
> Hi GIno,
>
> QGIS should 'just show/open/ geotiff's fine.
>
> Can you open the geotiff in another viewer?
> If not, or uncertain, are you sure it is a GEO-tiff (that is it contains the 
> spatial
> info?) and not a 'normal tiff'?
> If so: can you provide the output of 'ogrinfo ? This should show
> you info about the CRS/bbos/scale etc...
>
> Is the CRS (Coordinate Projection System / 'projection') of your tiff set to 
> the
> right value (comparted to your other layers or project crs)?
>
> Regards,
>
> Richard Duienvoorde
>
> On 4/25/23 21:53, Gino via QGIS-User wrote:
> > Hello,
> > Good afternoon. Just wanted to send an email to request advice on
> opening a GEOTIFF file in QGIS. I'm trying to open a .tif file with QGIS;
> however, unable to view the data and not sure why. Please let me know
> best way to view this file type in QGIS.
> > Thank you,
> > Gino
> >
> > ___
> > 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 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-it-user] Cancellazione console

2023-04-26 Thread Andrea Giudiceandrea via QGIS-it-user

Il 06/04/2023 21:16, Andrea Giudiceandrea ha scritto:

Il 06/04/2023 19:49, Giulio Fattori ha scritto:

che codice occorre per cancellare la console da pyqgis?


Ciao Giulio,
questo dovrebbe fare al caso tuo...

from console import console
console._console.console.shellOut.clearConsole()


Ciao Giulio,
hai risolto il problema?

A presto.

Andrea
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user