Re: [Qgis-user] using difference on buffers

2021-01-18 Per discussione qgis-user

  
  
Here's a script to buffer each feature, difference the original from
the buffered, and leave the difference in a new layer.
The script operates on the active layer and assumes it is a polygon
layer. The results will be unpredictable if it's not.
At the top of the script are two parameters, buf_dist and
buf_segments. These have the same meaning as the buffer operation in
geoprocessing. Remember that the buf_dist is in the units of the
CRS. My test data was in meters, so the buf_dist = 1 is 10
kilometers. 
All the attributes are copied to the new layer, which is called
buffer_diff. Attributes that are based on the geometry are NOT
recalculated, so areas or perimeters will be wrong. 
If you run this from the python console, as each feature is
processed you'll get the message "Adding feature". After the last
feature is added there may be a noticeable pause before the canvas
is repainted. 

I've only tried this on a couple of layer files and they were both
in the same CRS, so let me know if this fails for your data and I'll
see what I can do. 


  

from qgis.utils import iface
from qgis.core import QgsFeatureRequest, QgsProject, QgsSpatialIndex, QgsFillSymbol
from PyQt5.QtCore import Qt

#set the buffer distance in CRS units
buf_dist = 1
#set # segments for curves
buf_segments = 5


#get the active layer
layer = iface.activeLayer()

#create a memory layer for the new features
#create a url from the layer type and the layer crs
crs = layer.sourceCrs();
url = 'Polygon?crs=' + crs.authid()
print (url)

#create the new memory layer
buf_layer = QgsVectorLayer(url, "buffer_diff", "memory")

#add the attributes of the active layer to the new memory layer`
attrs = layer.dataProvider().fields().toList()
buf_layer.dataProvider().addAttributes(attrs)
buf_layer.updateFields()

feats = []
#loop through the features, creating buffer and difference
for f in layer.getFeatures():
print("Adding feature")
geom = f.geometry()
buf = geom.buffer(float(buf_dist), int(buf_segments))
dif = buf.difference(geom)
new_feat = QgsFeature()
new_feat.setGeometry(dif)
new_feat.setAttributes(f.attributes())
feats += [new_feat]

buf_layer.dataProvider().addFeatures(feats)
buf_layer.updateExtents()

QgsProject.instance().addMapLayer(buf_layer)
___
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] using difference on buffers

2021-01-18 Per discussione Chan Dolan
Yes I think you got it right!

I don't know how to use python very well, so I'd appreciate some code to
work off of. No rush though!

On Mon, Jan 18, 2021 at 2:00 PM  wrote:

> If I understand correctly, your problem is that the layer you are
> buffering has multiple polygons and the buffer around polygon 1 might
> intersect polygon2, so if you buffer the layer, then difference the layer
> from the buffer, you lose these overlaps. What you want is to difference
> buffer 1 with polygon 1, buffer 2 with polygon 2, etc.
>
> I am not aware of a way to do that from the GUI, but it's only a couple of
> line in PyQgis. You need to loop over the features of the buffer layer,
> differencing the corresponding polygon from the original layer. In my quick
> test, the FID is preserved across the two layers. The feature order appears
> to be the same, but it would be prudent to sort the two lists of features
> first to be sure of the same order. Then it's just a matter of looping over
> the features and calling the difference method on the two geometries and
> adding the result to your new layer.
>
> If nobody comes up with a better method or code and you don't know how to
> write Python, I'll probably have a bit of time later today to bang this out.
>
___
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] Help - Scorciatoia da tastiera

2021-01-18 Per discussione Gabriela Osaci-Costache
 Ciao, Totò!
Ottimo e utile, come sempre! Grazie mille!
Saluti,Gabriela

Il lunedì 18 gennaio 2021, 17:59:03 EET, Totò  
ha scritto:  
 
 Buonasera,
ho realizzato un miniTutorial tramite video

https://youtu.be/BSI1JNoEC9U

saluti



-
https://pigrecoinfinito.wordpress.com/
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Italian-User-f5250612.html
___
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-user] using difference on buffers

2021-01-18 Per discussione qgis-user

  
  
If I understand correctly, your problem is that the layer you are
buffering has multiple polygons and the buffer around polygon 1
might intersect polygon2, so if you buffer the layer, then
difference the layer from the buffer, you lose these overlaps. What
you want is to difference buffer 1 with polygon 1, buffer 2 with
polygon 2, etc.

I am not aware of a way to do that from the GUI, but it's only a
couple of line in PyQgis. You need to loop over the features of the
buffer layer, differencing the corresponding polygon from the
original layer. In my quick test, the FID is preserved across the
two layers. The feature order appears to be the same, but it would
be prudent to sort the two lists of features first to be sure of the
same order. Then it's just a matter of looping over the features and
calling the difference method on the two geometries and adding the
result to your new layer.

If nobody comes up with a better method or code and you don't know
how to write Python, I'll probably have a bit of time later today to
bang this out.
  

___
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] Domanda e problema su impostazione campi come checkbox

2021-01-18 Per discussione Studio Tecnico Dr. Forestale Nicola Scantamburlo - News

Buongiorno a tutti!

Mi presento: sono Nicola Scantamburlo, un dottore forestale libero 
professionista della provincia di Venezia. Non ho mai scritto nella 
lista ma vi seguo con molto interesse ormai da qualche anno!


Vengo al mio problema: sto predisponendo un progetto QGIS che poi vorrei 
usare in QField per raccogliere alcuni dati in campagna. Tra gli altri, 
ho bisogno di diversi campi che imposto in Proprietà>Moduli come 
“Casella di Controllo”, e vorrei ritrovarmi in tabella attributi, una 
volta raccolti i dati e tornato in “fase desktop” su QGIS, il valore “X” 
per i gli elementi con il check e “[NULL]” per gli elementi senza il 
check. Guardando alcuni tutorial su Youtube e trovati su internet, 
sembra che il modo per ottenere questo risultato sia quello di 
utilizzare le opzioni “Rappresentazione dello stato selezionato” e 
“Rappresentazione dello stato deselezionato” in Proprietà>Moduli, con 
l’opzione “Casella di Controllo” selezionata nel menù a tendina “Tipo 
widget”. Nei tutorial che ho seguito infatti, sembra funzionare 
correttamente (almeno fino a QGIS 3.8, la versione usata nella guida 
passo-passo che ho trovato su Youtube). Applicandoli al mio caso però 
ottengo in tabella attributi il valore “vero” per gli elementi con il 
check (e con “X” indicato nel campo “Rappresentazione dello stato 
selezionato” prima menzionato) e il valore “[NULL]” per gli elementi 
senza il check (e con il campo “Rappresentazione dello stato 
deselezionato” lasciato vuoto).


Sto sbagliando qualcosa? C’è qualche impostazione che devo settare di 
cui non mi accorgo? O posso solo ottenere valori vero/NULL e dovrò 
elaborare i dati in post-rilievo? O può essere un baco da segnalare?


Grazie in anticipo per le risposte e i commenti! A questo link 
(https://drive.google.com/drive/folders/10qsI8zpZxAChbGxtCt1JussouazknVeb?usp=sharing 
) 
degli screenshot con le impostazioni così come le ho settate io per uno 
dei campi impostato come casella di controllo e con quello che ottengo 
in tabella attributi.


PS: Uso QGIS 3.16.2 Hannover con sistema operativo Windows 10, ma ho 
provato anche con QGIS 3.10 e ottengo il medesimo risultato.


Saluti a tutti e grazie di nuovo!

Nicola

--


Studio Tecnico Dr. Forestale Nicola Scantamburlo - News

Consulenza Agricola, Forestale e Ambientale

Via Liguria 18/A

30037 Scorzè (VE)

www.studioforestalescantamburlo.com 



n...@studioforestalescantamburlo.com 



n.scantambu...@epap.conafpec.it 

Tel. 041 44 52 24

Fax 041 44 63 78

Cell. 349 17 80 821

NOTA DI RISERVATEZZA
Il presente messaggio e ogni suo allegato contengono informazioni 
strettamente riservate.
Unico soggetto legittimato a usarlo, copiarlo e, sotto la propria 
responsabilità, diffonderlo è esclusivamente il destinatario sopra indicato.
Chiunque ricevesse questo messaggio per errore è informato che 
trattenerlo, copiarlo, diffonderlo a persone diverse dal destinatario
è severamente proibito, ed è pregato di rinviarlo immediatamente al 
mittente distruggendone l'originale.


CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons 
above and may contain confidential information.
If you have received the message in error, be informed that any use of 
the content here of is prohibited.

Please return it immediately to the sender and delete the message.

albero pianeta.jpg



Rispetta l’ambiente, non stampare questa e-mail se non necessario.

Care about your environment, don’t print this e-mail if not necessary.



--
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


[Qgis-user] using difference on buffers

2021-01-18 Per discussione Chan Dolan
Hi all!

I created buffers around multiple features of a layer. Eventually, I want
to be able to calculate the proportion of land cover classes in the
buffers, excluding the area within the original layer that the buffer was
created from.

When I try to extract just the buffer, it takes into account all the
features and messes with individual buffers.

How can I extract each buffer individually, without compromising the buffer
shape and without having to do each feature one by one?

Sorry if this question doesn't make a lot of sense! I can rephrase if
needed!

Thanks!

-Chan
___
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] PostgreSQL connection in Data Source Manager and geometry type GEOMETRY

2021-01-18 Per discussione Dirk.Pispers
Dear List,

in version 3.10 LTR when connecting to a PostgreSQL database with the Data 
Source Manager, QGIS performs a query to determine all occurring geometry types 
in tables and views that have the unrestricted geometry type GEOMETRY.
In one of our main databases (size about 65 GB) this query needs 130 GB of 
temporary disc space and causes an incident, when the storage on the server 
runs out.
Of course the user can prevent this by checking the "Don't resolve type of 
unrestricted columns (GEOMTRY)", but if this is not default, most users even 
don't understand the meaning of the option.

The statement QGIS sends to the database is:
SELECT 0, array_agg(DISTINCT 25832::text || ':' || 
UPPER(geometrytype("geometrie")))  FROM ""."y"
UNION
SELECT 1, ...
and so on for 148 tables.

Because there were obviosly changes in this part of the program between 3.4 LTR 
and 3.10 LTR, we examined this query in 3.4 too.
There is one single query generated for each table instead of one query for all 
tables together connected with UNION.
This was much more ressource-friendly than the current query is.

A test in version 3.16 showed the same query as in 3.10 LTR is used.

Does anyone know, why the query was changed between 3.4 an 3.10?
Maybe there is a way to modify the query once more to avoid database incidents.

Thank you and kind regards

Dirk






Monatlich aktuelle Informationen Ihrer Stadtverwaltung in unserem Newsletter! 
Newsletter 
Anmeldung



[https://styleguide.bundesregierung.de/resource/blob/72496/1760346/6d7f611945ca42908c50804510c5335b/breg-vorschaubild-01-unterstuetzt-842x595px-jpg-srgb-v01-data.png]
___
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] Help - Scorciatoia da tastiera

2021-01-18 Per discussione Totò
Buonasera,
ho realizzato un miniTutorial tramite video

https://youtu.be/BSI1JNoEC9U

saluti



-
https://pigrecoinfinito.wordpress.com/
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Italian-User-f5250612.html
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


[QGIS-it-user] Autocompletamento campi da tabella preesistente

2021-01-18 Per discussione salvioscogna
Salve a tutti. 

Dovendo fare un rilievo su campo con qfield vorrei semplificare il lavoro
utilizzando una tabella preesistente... mi spiego meglio. Ho bisogno di
rilevare delle insegne pubblicitarie sul territorio (per questo ho creato un
semplice shape file puntuale) e individuare il titolare dell'insegna. Avendo
già una tabella 'anagrafica' vorrei, in fase di rilievo, selezionare il
titolare direttamente dalla tabella preesistente e collegarlo al punto
digitato. É possibile? La mia idea sarebbe quella di inserire un campo nel
quale digitare il nome del titolare, a questo punto dovrebbe comparire il
suggerimento automatico in base ai nominativi presenti nella tabella
preesistente e avere la possibilità di selezionarli per collegarli al punto
battuto.
Vi ringrazio in anticipo per il prezioso aiuto.





--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Italian-User-f5250612.html
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


Re: [Qgis-user] compound punti, linee, aree

2021-01-18 Per discussione Paolo Cavallini
shp non può contenere geometry collections

Il 18/01/21 12:50, Silvia Fogolari ha scritto:
> Buongiorno,
> sono da poco transitata da Geomedia a Qgis.
> In Geomedia avevo la possibilità di creare uno shp file o un
> geopackage che contemplasse _contemporaneamente _punti, linee e aree.
> E' possibile fare la stessa cosa anche in Qgis?
> Grazie
> -- 
> 
> /Dott.ssa Silvia Fogolari/
> 
> /Unità Organizzativa Forestale// - Ufficio di Vicenza/
> 
> /Uff. Selvicoltura e attività silvopastorali/
> 
> /
> /
> 
> /Contrà Mure S. Rocco, 51 – 36100 Vicenza (VI)/
> 
> /tel. 0444-337080/
> 
> /fax 0444-337097/
> 
> /
> /
> 
> /silvia.fogol...@regione.veneto.it
> /
> 
> /forest...@regione.veneto.it /
> 
> /forest...@pec.regione.veneto.it //
> /
> 
> 
> 
> /Ai sensi del vigente D.Lgs. 196/2003 in materia di privacy e del
> Regolamento (UE) 2016/679 del Parlamento europeo e del Consiglio si
> precisa che le informazioni contenute nel messaggio e negli eventuali
> allegati sono riservate esclusivamente al/ai destinatario/i indicato/i.
> Si invita ad astenersi dall'effettuare: inoltri, copie, distribuzioni e
> divulgazioni non autorizzate del presente messaggio e degli eventuali
> allegati. Nel caso di erroneo recapito, si chiede cortesemente a chi
> legge di dare immediata comunicazione al mittente e di cancellare il
> presente messaggio e gli eventuali allegati. Informazioni aggiuntive
> nella sezione **Privacy** del sito internet: www.regione.veneto.it
>   /
> /--/
> /According to the Italian law D.Lgs. 196/2003 and the Regulation (EU)
> 2016/679 of the European Parliament and of the Council the information
> contained in this message and any attachment contained therein is
> addressed exclusively to the intended recipient. Please refain to not
> make copies, to forward the message and its attachments or disclose
> their content unless authorisation./
> /In case of incorrect delivered message to your mail, please inform
> immediately the sender and delete the message and its attachments.
> Additional information are available in the **Privacy** section, on the
> website: www.regione.veneto.it /
> 
> ___
> 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
> 

-- 
Paolo Cavallini
www.faunalia.eu - QGIS.org
training, support, development on QGIS, PostGIS and more
___
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] Help - Scorciatoia da tastiera

2021-01-18 Per discussione Totò
Roberto brascugli wrote
> Ciao Stefano, 
> 
> vorrei poter utilizzare la tastiera per "mostrare/nascondere" uno layer
> specificandone il nome.
> 
> In altre parole vorrei evitare di agire sul flag del pannello Layer.
> 
> Grazie mille
> 
> Roberto Brascugli

Ciao Roberto,
un modo sarebbe quello di utilizzare la Bar Locator; prima però definisci
una scorciatoia da tastiera per attiva/disattiva layer selezionato, per
esempio alt+n:

poi:

ctrl +k
digiti l per attivare la ricerca dei layer nella TOC e rendere attivo il
layer cercato;
poi, usi la scorciatoia definita per attivare disattivare layer attivo

saluti



-
https://pigrecoinfinito.wordpress.com/
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Italian-User-f5250612.html
___
QGIS-it-user mailing list
QGIS-it-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/qgis-it-user


[Qgis-user] compound punti, linee, aree

2021-01-18 Per discussione Silvia Fogolari
Buongiorno,
sono da poco transitata da Geomedia a Qgis.
In Geomedia avevo la possibilità di creare uno shp file o un geopackage che
contemplasse *contemporaneamente *punti, linee e aree.
E' possibile fare la stessa cosa anche in Qgis?
Grazie
-- 

*Dott.ssa Silvia Fogolari*

*Unità Organizzativa Forestale** - Ufficio di Vicenza*

*Uff. Selvicoltura e attività silvopastorali*


*Contrà Mure S. Rocco, 51 – 36100 Vicenza (VI)*

*tel. 0444-337080*

*fax 0444-337097*


*silvia.fogol...@regione.veneto.it *

*forest...@regione.veneto.it *

*forest...@pec.regione.veneto.it *

-- 
*Ai sensi del vigente D.Lgs. 196/2003 in materia di privacy e del 
Regolamento (UE) 2016/679 del Parlamento europeo e del Consiglio si precisa 
che le informazioni contenute nel messaggio e negli eventuali allegati sono 
riservate esclusivamente al/ai destinatario/i indicato/i. Si invita ad 
astenersi dall'effettuare: inoltri, copie, distribuzioni e divulgazioni non 
autorizzate del presente messaggio e degli eventuali allegati. Nel caso di 
erroneo recapito, si chiede cortesemente a chi legge di dare immediata 
comunicazione al mittente e di cancellare il presente messaggio e gli 
eventuali allegati. Informazioni aggiuntive nella sezione **Privacy** del 
sito internet: www.regione.veneto.it   *
*--*
*According to the Italian law D.Lgs. 
196/2003 and the Regulation (EU) 2016/679 of the European Parliament and of 
the Council the information contained in this message and any attachment 
contained therein is addressed exclusively to the intended recipient. 
Please refain to not make copies, to forward the message and its 
attachments or disclose their content unless authorisation.*
*In case of 
incorrect delivered message to your mail, please inform immediately the 
sender and delete the message and its attachments. Additional information 
are available in the **Privacy** section, on the website: 
www.regione.veneto.it *

___
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] Help - Scorciatoia da tastiera

2021-01-18 Per discussione Roberto Brascugli
Ciao Stefano, 

vorrei poter utilizzare la tastiera per "mostrare/nascondere" uno layer
specificandone il nome.

In altre parole vorrei evitare di agire sul flag del pannello Layer.

Grazie mille

Roberto Brascugli


--
Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
This message was scanned by Libra ESVA and is believed to be clean.

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


[Qgis-user] Call for presentations and attendees: QGIS Open Day, January 29, 2021

2021-01-18 Per discussione Tim Sutton
Dear QGIS Users

On Friday, 29 January 2021 we will be holding our monthly QGIS Open Day!
What is a QGIS Open Day you may be wondering to yourself? It is an
initiative to replace the wonderful community meetups we used to hold every
six months when times were different. Like our in-person meetings, the
event is organised on a principle of self-organisation and community
participation.

*Programme*

1 QGIS Dashboards - Next Level 10h00 UTC Tim Sutton, Luis Eduardo

2 QGIS Point Clouds 11h15 UTC Tim Sutton, Martin Dobias, Saber Razmjooei,
Nyall Dawson

3 QGIS Ask Me Anything 14h00 UTC Tim Sutton and various experts (panel
volunteers please contact me)

See "where to watch" below for the link to the wiki page with session times
etc., additional sessions on the day may be announced there.



*Adding more events*

You can do this too! We really encourage others to follow our initiative,
using the wiki page link below to organise your plans (just add a section
below the last one). You can host virtual meetups in the Jitsi room, plan
your next steps to take QGIS further down the road to world domination and
much much more. We encourage language and region specific huddles,
documentation improvement sessions, bug fixing, making beautiful maps, and
working together to do amazing things with QGIS.

I would really love to see more events offered from our  country user
groups and broader user base. The content can be at any skill level and in
any language you like, and the times can overlap if needed. So please feel
free to organise your activities on the wiki page (see link below). The
QGIS Open Day is also an ideal time to hold virtual country user group meet
ups - please share your activities on the open day schedule, so that even
people from outside of your country user group can benefit from your
presentations. Contact me (see below) if you need help adding your events
to the wiki page.

*Where to watch*

Please see the event wiki page at
https://github.com/qgis/QGIS/wiki/QHF-January-2021 for all the details of
times and links for watching. Get Involved!

*Code of Conduct*

Participants are kindly reminded to please read and observe our QGIS Code
of Conduct and Diversity Statement to make these events a great experience
for everyone!

https://www.qgis.org/en/site/getinvolved/governance/codeofconduct/codeofconduct.htmlhttps://www.qgis.org/en/site/getinvolved/governance/codeofconduct/diversitystatement.html

Please contact me (Tim Sutton) by email (t...@kartoza.com) or via the QGIS
Open Day Telegram User Group (https://t.me/joinchat/Aq2V5RPoxYYhXqUPoxRWPQ
user @timlinux_pt) if you have any queries or need help setting up events.

We look forward to seeing you there!
Regards

Tim

-- 
--

Tim Sutton
Visit http://kartoza.com to find out about open source:
 * Desktop GIS programming services
 * Geospatial web development
* GIS Training
* Consulting Services
Tim is a member of the QGIS Project Steering Committee
---
___
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