-
Notifications
You must be signed in to change notification settings - Fork 2
/
geometrias_imprestaveis.py
54 lines (46 loc) · 1.86 KB
/
geometrias_imprestaveis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: utf-8 -*-
"""
/***************************************************************************
3 CGEO
3th Brazilian Geoinformation Center
-------------------
begin : 2017-05-30
copyright : (C) 2017 by Leandro Franca - Cartographic Engineer @ Brazilian Army
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
"""
# Identifica geometrias imprestaveis
##Geometrias Problematicas=name
##LF11) Outros=group
##Arquivo_txt=output file
if Arquivo_txt[-4:] != '.txt':
Arquivo_txt += '.txt'
# Criar arquivo txt
arquivo = open(Arquivo_txt, 'w')
arquivo.write('RELATORIO DE GEOMETRIAS IMPRESTAVEIS\n')
from PyQt4.QtCore import *
from qgis.gui import QgsMessageBar
from qgis.utils import iface
from qgis.core import *
import time
cont = 0
for layer in QgsMapLayerRegistry.instance().mapLayers().values():
nome = layer.name()
for feat in layer.getFeatures():
geom = feat.geometry()
if not geom:
id = feat.id()
arquivo.write('Classe: %s, Id: %d \n' %(nome, id))
cont +=1
if cont>0:
arquivo.write('Total de %d geometrias com problema.\n' %cont)
else:
arquivo.write('Nao existe geometria imprestavel na lista de camadas.')
arquivo.close()