Find Neighbor Polygons in a Layer



Vergelijkbare documenten
Getting Started with Python Programming

Leaflet Web Maps with qgis2leaf

Sampling Raster Data using Points or Polygons

Searching and Downloading OpenStreetMap Data

Using Google Maps Engine Connector for QGIS

DHL Parcel / DHL4You. Een OpenCart x verzend optie. Gerrit Bouweriks

Automating Complex Workflows using Processing Modeler

Automating Map Creation with Print Composer Atlas

Working with Terrain Data

Creating Heatmaps. QGIS Tutorials and Tips. Author. Ujaval Gandhi Translations by. Dick Groskamp

Georeferencing Aerial Imagery

Running and Scheduling QGIS Processing Jobs

Using the QGIS Browser

Making A Map. QGIS Tutorials and Tips. Author. Ujaval Gandhi Translations by. Dick Groskamp

Tilburg University. Technieken van kwalitatief onderzoek 1 Verhallen, T.M.M.; Vogel, H. Published in: Tijdschrift voor Marketing

myphp Guestbook v Copyright Claudio Pose myphp Guestbook was an Open Source project from <Networkarea.ch>, Claudio Pose.

Tilburg University. Dienstenkeurmerken misbruikt Roest, Henk; Verhallen, T.M.M. Published in: Tijdschrift voor Marketing. Publication date: 1999

MyDHL+ Van Non-Corporate naar Corporate

Het opschorten van de handel op de Amsterdamse Effectenbeurs Kabir, M.R.

Markt- en marketingonderzoek aan Nederlandse universiteiten Verhallen, T.M.M.; Kasper, J.D.P.

Tilburg University. Energiebesparing door gedragsverandering van Raaij, Fred; Verhallen, T.M.M. Published in: Psychologie. Publication date: 1982

Tilburg University. Hoe psychologisch is marktonderzoek? Verhallen, T.M.M.; Poiesz, Theo. Published in: De Psycholoog. Publication date: 1988

Begrip image kent in wetenschap allerlei uiteenlopende definities Verhallen, T.M.M.

Tilburg University Het voorkomen van merkverwarring General rights Take down policy

Procrustes analyse (1) Steenkamp, J.E.B.M.; van Trijp, J.C.M.; Verhallen, T.M.M.

Tilburg University. Huishoudelijk gedrag en stookgasverbruik van Raaij, Fred; Verhallen, T.M.M. Published in: Economisch Statistische Berichten

Tilburg University. Huisvuilscheidingsproeven in Nederland Pieters, Rik; Verhallen, T.M.M. Published in: Beswa-Revue. Publication date: 1985

Tilburg University. Canonische analyse in markt- en marketingonderzoek Kuylen, A.A. A.; Verhallen, T.M.M. Published in: Tijdschrift voor Marketing

Het beheren van mijn Tungsten Network Portal account NL 1 Manage my Tungsten Network Portal account EN 14

2019 SUNEXCHANGE USER GUIDE LAST UPDATED

Table of Contents. FireFox...1. Firefox installeren op OS X...2 Firefox downloaden...2. Firefox installeren op Windows...6 Firefox Downloaden...

Tilburg University. Technieken van kwalitatief onderzoek 2 Verhallen, T.M.M.; Vogel, H.P. Published in: Tijdschrift voor Marketing

LDAP Server on Yeastar MyPBX & tiptel 31xx/32xx series

Biodiversity responses to climate and land-use change: A historical perspective Aguirre Gutierrez, J.

Firewall van de Speedtouch 789wl volledig uitschakelen?

De invloed van preferente beschermingsaandelen op aandelenkoersen Cantrijn, A.L.R.; Kabir, M.R.

Van 'gastarbeider' tot 'Nederlander' Prins, Karin Simone

Welke factoren beïnvloeden het gezamenlijk leren door leraren? Een systematische literatuurreview Thurlings, M.C.G.; den Brok, P.J.

Hoe met Windows 8 te verbinden met NDI Remote Office (NDIRO) How to connect With Windows 8 to NDI Remote Office (NDIRO

University of Groningen. Stormy clouds in seventh heaven Meijer, Judith Linda

Published in: Onderwijs Research Dagen 2013 (ORD2013), mei 2013, Brussel, Belgie

Tilburg University. Economische psychologie Verhallen, T.M.M. Published in: De Psycholoog. Publication date: Link to publication

Les drie. Vormen van data in AutoLISP

Tilburg University. Domein-specifieke marktsegmentatie van Raaij, Fred; Verhallen, T.M.M. Published in: Handboek marketing, 3e ed.

Tilburg University. Deelname aan huisvuilscheidingproeven Pieters, Rik; Verhallen, T.M.M. Published in: Toegepaste sociale psychologie 1

Settings for the C100BRS4 MAC Address Spoofing with cable Internet.

Shipment Centre EU Quick Print Client handleiding [NL]

SAMPLE 11 = + 11 = + + Exploring Combinations of Ten + + = = + + = + = = + = = 11. Step Up. Step Ahead

LONDEN MET 21 GEVARIEERDE STADSWANDELINGEN 480 PAGINAS WAARDEVOLE INFORMATIE RUIM 300 FOTOS KAARTEN EN PLATTEGRONDEN

General info on using shopping carts with Ingenico epayments

EM7680 Firmware Update by OTA

University of Groningen. Up2U Harder, Annemiek T.; Eenshuistra, Annika

Esther Lee-Varisco Matt Zhang

This appendix lists all the messages that the DRS may send to a registrant's administrative contact.

DALISOFT. 33. Configuring DALI ballasts with the TDS20620V2 DALI Tool. Connect the TDS20620V2. Start DALISOFT

copyrighted image removed Mark Bakker 1

De wet van de grote(re) getallen Jacobs, Daan; van Zuydam, Sabine; van Ostaaijen, Julien; de Brouwer, Leon

Handleiding Remote Engineer Portal

1. Voor het installeren wordt geadviseerd een backup te maken van uw database en bestanden.

How to install and use dictionaries on the ICARUS Illumina HD (E652BK)

Hoe te verbinden met NDI Remote Office (NDIRO): Apple OS X How to connect to NDI Remote Office (NDIRO): Apple OS X

Tilburg University. Chapters 1-7 Bouckaert, L.; Sels, A.T.H.

ICARUS Illumina E653BK on Windows 8 (upgraded) how to install USB drivers

Bouwen op een gemeenschappelijk verleden aan een succesvolle toekomst Welling, Derk Theodoor

Handleiding gogo account. versie 2.1 Copyright 2011 Sander Kooijmans

Tilburg University. Publication date: Link to publication

EM7580 Firmware Update by Micro SD card

EM7680 Firmware Update by Micro SD card

Handleiding Zuludesk Parent

Empowering the circular economy through procurement. DEEL 5, AUTORISATIE Guidance document 20 March 2018

Het binnen planning en budget realiseren van werkzaamheden in een buitendienststelling bij zowel spoor- als wegverkeer door de projectorganisatie

Gebruikershandleiding Versie 1.07

Installatie van Windows 10 op laptops. Windows 10 installation on laptops

Improving the properties of polymer blends by reactive compounding van der Wal, Douwe Jurjen


NMOZTMKUDLVDKECVLKBVESBKHWIDKPDF-WWUS Page File Size 9,952 KB 29 May, 2016

De spaarder Alessie, R.J.M.; Camphuis, H.; Kapteyn, A.; Klijn, F.; Verhallen, T.M.M.

University of Groningen. Structured diabetes care in general practice Fokkens, Sudara Andrea

Handleiding registreren in de portal

University of Groningen. Vrije en reguliere scholen vergeleken Steenbergen, Hilligje

"Our subcultural shit-music": Dutch jazz, representation, and cultural politics Rusch, L.

Dynamics of inner ear pressure change with emphasis on the cochlear aqueduct Laurens-Thalen, Elisabeth Othilde

Standard Parts Installatie Solid Edge ST3

JOB OPENING OPS ENGINEER

Een model voor personeelsbesturing van Donk, Dirk

Preschool Kindergarten

University of Groningen. Safe and Sound van den Bosch, Kirsten Anna-Marie

Citation for published version (APA): Mazzola, P. (2016). Phenylketonuria: From body to brain [Groningen]: Rijksuniversiteit Groningen

Engels op Niveau A2 Workshops Woordkennis 1

University of Groningen

Understanding the role of health literacy in self-management and health behaviors among older adults Geboers, Bas

Veel gestelde vragen nieuwe webloginpagina

EM7680 Firmware Update by Micro SD card or USB

Aan deze vertaling kunnen geen rechten worden ontleend.

Draagvlak migratiebeleid Postmes, Thomas; Gordijn, Ernestine; Kuppens, T.; Gootjes, Frank; Albada, Katja

Zo werkt het in de apotheek (Basiswerk AG) (Dutch Edition)

Gebruikershandleiding

Citation for published version (APA): Hartman, H. T. (2017). The burden of myocardial infarction [Groningen]: Rijksuniversiteit Groningen

De betrouwbaarheid van kleinschalige methoden voor waterzuivering Kaaij, Rachel van der

Bedrijfsovername en milieurecht : een onderzoek naar juridische aspecten van bedrijfsovername en milieu Mellenbergh, R.

Transcriptie:

Find Neighbor Polygons in a Layer QGIS Tutorials and Tips Author Ujaval Gandhi http://google.com/+ujavalgandhi Translations by Dick Groskamp This work is licensed under a Creative Commons Attribution 4.0 International License.

Naburige polygonen in een laag zoeken Er zijn soms enkele gevallen waar u alle naburige polygonen wilt vinden van elke polygoon in een laag. Met een llein script in Python kunnen we dit en nog veel meer bereiken in QGIS. Hier is een voorbeeldscript dat u kunt gebruiken om alle polygonen te zoeken die een grens delen met elk van de polygonen in een laag en ook hun namen toevoegen aan de attributentabel. Als toegevoegde bonus sommeert het script ook een attribuut naar keuze voor alle naburige polygonen. Overzicht van de taak We zulle een laag van polygonen van landen gebruiken en landen zoeken die een grens delen, om te demonstreren hoe het script werkt. We willen ook de totale bevolking berekenen van het buren van het land. De gegevens ophalen We zullen de gegevensset Admin 0 - Countries van Natural Earth gebruiken. Download het Admin 0 - countries shapefile.. Gegevensbron [NATURALEARTH] Het script ophalen Download het script neighbors.py en sla het op op uw schijf. Procedure 1. Laad de laag ne_10m_admin_0_countries door te gaan naar Kaartl;agen Laag toevoegen Vectorlaag toevoegen.

2. Het script gebruikt 2 velden om de actie uit te voeren. Een naamveld en een veld dat u bij elkaar wilt optellen. gebruik het gereedschap Objecten identificeren om op een object te klikken en de attributen te bekijken. In dit geval is het naamveld NAME en willen we de geschatte bevolking bij elkaar optellen vanuit het veld POP_EST.

3. Ga naar Plug-ins Python Console.

4. Klik, in het venster van Python Console, op de knop Toon editor.

5. Klik, in het paneel Editor, op de knop Bestand openen en blader naar het gedownloade script neighbors.py en klik op Openen.

6. Als het script eenmaal is geladen, wilt u misschien de waarden voor _NAME_FIELD en _SUM_FIELD wijzigen om overeen te komen met de attributen van uw eigen laag. Als u werkt met de laag ne_10m_admin_0_countries kunt u ze laten zoals ze zijn. Klik op de knop Opslaan in het paneel Editor als u wijzigingen hebt gemaakt. Klik nu op de knop Script uitvoeren om het script uit te voeren.

7. Klik met rechts, als het script is voltooid, op de laag ne_10m_admin_0_countries en selecteer Open attributentabel.

8. U zult opmerken dat er 2 nieuwe attributen zijn, genaamd NEIGHBORS en SUM. Deze werden door het script toegevoegd.

Hieronder staat het volledige script als verwijzing. U kunt het aanpassen zodat het aan uw eigen wensen voldoet. ################################################################################ # Copyright 2014 Ujaval Gandhi # #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. # #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. # #You should have received a copy of the GNU General Public License #along with this program; if not, write to the Free Software #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # ################################################################################ from qgis.utils import iface from PyQt4.QtCore import QVariant # Replace the values below with values from your layer. # For example, if your identifier field is called 'XYZ', then change the line # below to _NAME_FIELD = 'XYZ' _NAME_FIELD = 'NAME' # Replace the value below with the field name that you want to sum up. # For example, if the # field that you want to sum up is called 'VALUES', then # change the line below to _SUM_FIELD = 'VALUES'

_SUM_FIELD = 'POP_EST' # Names of the new fields to be added to the layer _NEW_NEIGHBORS_FIELD = 'NEIGHBORS' _NEW_SUM_FIELD = 'SUM' layer = iface.activelayer() # Create 2 new fields in the layer that will hold the list of neighbors and sum # of the chosen field. layer.startediting() layer.dataprovider().addattributes( [QgsField(_NEW_NEIGHBORS_FIELD, QVariant.String), QgsField(_NEW_SUM_FIELD, QVariant.Int)]) layer.updatefields() # Create a dictionary of all features feature_dict = {f.id(): f for f in layer.getfeatures()} # Build a spatial index index = QgsSpatialIndex() for f in feature_dict.values(): index.insertfeature(f) # Loop through all features and find features that touch each feature for f in feature_dict.values(): print 'Working on %s' % f[_name_field] geom = f.geometry() # Find all features that intersect the bounding box of the current feature. # We use spatial index to find the features intersecting the bounding box # of the current feature. This will narrow down the features that we need # to check neighboring features. intersecting_ids = index.intersects(geom.boundingbox()) # Initalize neighbors list and sum neighbors = [] neighbors_sum = 0 for intersecting_id in intersecting_ids: # Look up the feature from the dictionary intersecting_f = feature_dict[intersecting_id] # For our purpose we consider a feature as 'neighbor' if it touches or # intersects a feature. We use the 'disjoint' predicate to satisfy # these conditions. So if a feature is not disjoint, it is a neighbor. if (f!= intersecting_f and not intersecting_f.geometry().disjoint(geom)): neighbors.append(intersecting_f[_name_field]) neighbors_sum += intersecting_f[_sum_field] f[_new_neighbors_field] = ','.join(neighbors) f[_new_sum_field] = neighbors_sum # Update the layer with new attribute values. layer.updatefeature(f) layer.commitchanges() print 'Processing complete.'