1 |
1 |
# -*- coding: utf-8 -*-
|
2 |
2 |
#-----------------------------------------------------------
|
3 |
|
#
|
|
3 |
#
|
4 |
4 |
# Join Attributes
|
5 |
5 |
#
|
6 |
6 |
# A QGIS plugin for performing an attribute join between vector layers.
|
... | ... | |
13 |
13 |
# WEB : www.geog.uvic.ca/spar/carson
|
14 |
14 |
#
|
15 |
15 |
#-----------------------------------------------------------
|
16 |
|
#
|
|
16 |
#
|
17 |
17 |
# licensed under the terms of GNU GPL 2
|
18 |
|
#
|
|
18 |
#
|
19 |
19 |
# This program is free software; you can redistribute it and/or modify
|
20 |
20 |
# it under the terms of the GNU General Public License as published by
|
21 |
21 |
# the Free Software Foundation; either version 2 of the License, or
|
22 |
22 |
# (at your option) any later version.
|
23 |
|
#
|
|
23 |
#
|
24 |
24 |
# This program is distributed in the hope that it will be useful,
|
25 |
25 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
26 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
27 |
# GNU General Public License for more details.
|
28 |
|
#
|
|
28 |
#
|
29 |
29 |
# You should have received a copy of the GNU General Public License along
|
30 |
30 |
# with this program; if not, write to the Free Software Foundation, Inc.,
|
31 |
31 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
32 |
|
#
|
|
32 |
#
|
33 |
33 |
#---------------------------------------------------------------------
|
34 |
34 |
|
35 |
35 |
from PyQt4.QtCore import *
|
... | ... | |
75 |
75 |
self.joinField.clear()
|
76 |
76 |
for i in changedField:
|
77 |
77 |
self.joinField.addItem(unicode(changedField[i].name()))
|
78 |
|
|
|
78 |
|
79 |
79 |
def accept(self):
|
80 |
80 |
if self.inShape.currentText() == "":
|
81 |
81 |
QMessageBox.information(self, self.tr("Join Attributes"), self.tr("Please specify target vector layer"))
|
... | ... | |
101 |
101 |
useTable = True
|
102 |
102 |
joinField = self.joinField.currentText()
|
103 |
103 |
outPath = self.outShape.text()
|
104 |
|
self.compute(inName, inField, joinName, joinField, outPath, keep, useTable, self.progressBar)
|
|
104 |
res = self.compute(inName, inField, joinName, joinField, outPath, keep, useTable, self.progressBar)
|
105 |
105 |
self.outShape.clear()
|
106 |
106 |
if res:
|
107 |
107 |
addToTOC = QMessageBox.question(self, self.tr("Join Attributes"),
|
... | ... | |
171 |
171 |
provider2.select(allAttrs, QgsRectangle(), False, False)
|
172 |
172 |
fieldList2 = ftools_utils.getFieldList(layer2)
|
173 |
173 |
index2 = provider2.fieldNameIndex(joinField)
|
174 |
|
fieldList2 = self.testForUniqueness(fieldList1, fieldList2.values())
|
|
174 |
fieldList2 = ftools_utils.testForUniqueness(fieldList1, fieldList2.values())
|
175 |
175 |
seq = range(0, len(fieldList1) + len(fieldList2))
|
176 |
176 |
fieldList1.extend(fieldList2)
|
177 |
177 |
fieldList1 = dict(zip(seq, fieldList1))
|