Re: [QGIS-it-user] Modificare la legenda di un layer categorizzato

2022-06-20 Thread Giulio Fattori

Il 19/06/2022 12:28, Andrea Giudiceandrea ha scritto:

Ciao Giulio,
sei riuscito a risolvere il problema apportando le modifiche suggerite?

A presto.

Andrea

Il 14/06/2022 17:31, Andrea Giudiceandrea ha scritto:

Ciao Giulio,
prima di tutto la riga 23 (new_renderer = 
QgsCategorizedSymbolRenderer()) mi pare sia superflua. Comunque il 
problema non dipende da questo.


A mio avviso il problema è dovuto al fatto che quando, nel ciclo for, 
assegni la simbologia di una categoria alla variabile new_sym 
(new_sym = category.symbol()), l'ownership di tale oggetto non viene 
trasferito, mentre nella creazione di un nuovo oggetto 
QgsRendererCategory(category.value(), new_sym, 
str(new_label[i])+alt_value) l'ownership della simbologia deve essere 
trasferito alla categoria (come indicato nella documentazione della 
classe QgsRendererCategory [1]).


Questo tentativo di trasferire ad un oggetto l'ownership che non si 
possiede di un altro oggetto creare il crash quando si tenta di 
accedere nuovamente all'oggetto.


Per ovviare a tale problema bisogna creare un clone ("deep copy") del 
simbolo in modo da possederne l'ownership affinché possa essere 
trasferito correttamente all'oggetto QgsRendererCategory.


Quindi penso che il problema possa essere risolto modificando il 
codice in uno dei seguenti due modi:


...
for i, category in enumerate(categories):
 new_sym = category.symbol()
 new_categories.append(QgsRendererCategory(category.value(), 
new_sym.clone(), str(new_label[i])+alt_value))

...

...
for i, category in enumerate(categories):
 new_sym = category.symbol().clone()
 new_categories.append(QgsRendererCategory(category.value(), 
new_sym, str(new_label[i])+alt_value))

...


A presto.

Andrea


Il 14/06/2022 13:23, Giulio Fattori ha scritto:


Buongiorno,

Ho realizzato questo script da console per modificare la legenda di 
un layer categorizzato.





Ciao Andrea,

mi scuso del ritardo nel risponderti ma ero in ferie e per qualche 
giorno niente pc.


La tua soluzione, come sempre, ha risolto efficacemente il problema e 
Toto ne ha fatto un post.


https://github.com/Korto19/Edit-Legend-Text-Categorized

L'algoritmo ha ancora qualche problema con layer filtrati ma per ora non 
ho avuto modo di capire come risolvere.


Grazie ancora e a presto

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


[Qgis-user] polygon fills from different shapefiles

2022-06-20 Thread Firstname Lastname via Qgis-user
i have four different geologic maps that i have imported as shapefiles.
The files have filled polygons that have the name of the geologic formation
in the attribute tables.  i would like to have a common colour for each
polygon of identical age/name for all the map sheets.  Each map sheet has a
similar list of formations, but some of the formations are different for
each map sheet.
What is the most efficient way to make the identically named polygons
displayed with the same colour?  Should i add a column in each attribute
table and put a formation code in for each one manually or can i add an RGB
colour for each formation in the attribute table? or, do i need to
categorize and  classify these in the layer properties table after i have
added formation code in the attribute table?
i hope that my question is clear.

-- 
Byron Veilleux, MSc. P.Geo
Conjugate Geologic Services Limited
Calgary, Alberta Canada
by...@conjugategeo.com
Cell:4037108414
___
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] Polar stereographic (0 - 360 longitudes)

2022-06-20 Thread Jeff McKenna via Qgis-user
Hi Lester, please consider asking this question direct to the PROJ 
community (as QGIS relies on PROJ for projection support): subscribe to 
the discussion forum at https://lists.osgeo.org/mailman/listinfo/proj , 
homepage at https://proj.org/


thanks,

-jeff



--
Jeff McKenna
GatewayGeo: Developers of MS4W, MapServer Consulting and Training
co-founder of FOSS4G
http://gatewaygeo.com/




On 2022-06-19 7:16 a.m., Lester Anderson via Qgis-user wrote:

Hi all,

I have data which is in 0-360 degree longitudes and I would like to 
apply a Polar stereographic projection. However, since the EPSG 3995 has 
limits of -180/+180 for longitude, as expected it gives half the plot.


For some reason I cannot create a custom projection with an extent such as:
xmin=0, xmax=360, ymin=60, ymax=90 based on 3995 even removing reference 
to this ID.


Any ideas how to proceed without having to shift it all to +/- 180

Tested in 3.20 and 3.24

Thanks

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