This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Define new functions using @qgsfunction. feature and parent must always be the | |
last args. Use args=-1 to pass a list of values as arguments | |
""" | |
from qgis.core import * | |
from qgis.gui import * | |
@qgsfunction(args='auto', group='GCFunctions') | |
def GetIntersectGeoms(layer_name, field_name, feature, parent): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Obter coordenada X e Y das unidades educacionais | |
SELECT e.nome, st_X(e.the_geom), st_Y(e.the_geom) FROM educacao e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Relacione todos os lotes que estão à 300 metros da Escola Municipal Espírito Santo. | |
SELECT l.insc_base FROM lotes l, educacao e | |
WHERE st_dwithin(e.the_geom, l.the_geom, 300) AND e.nome = 'E.M. Espirito Santo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Qual a distância entre a C.M. Madre Teresa de Calcutá e o bairro Aero Clube ? | |
SELECT st_distance(e.the_geom, b.the_geom) FROM educacao e, bairros b | |
WHERE e.nome = 'C.M. Madre Teresa de Calcuta' AND b.nome = 'AERO CLUBE' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Quais os loteamentos que estão dentro do bairro SANTO AGOSTINHO ? | |
SELECT lot.nome FROM loteamentos lot, bairros b | |
WHERE st_within(lot.the_geom, b.the_geom) AND b.nome = 'SANTO AGOSTINHO' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Qual ou quais ruas tocam no limite do bairro SANTO AGOSTINHO? | |
SELECT lot.nome FROM trecho_logradouros lot, bairros b | |
WHERE st_touches(lot.the_geom, b.the_geom) AND b.nome = 'SANTO AGOSTINHO' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Quais os loteamentos que interceptam os limites do bairro SANTO AGOSTINHO? | |
SELECT lot.nome FROM loteamentos lot, bairros b | |
WHERE st_overlaps(lot.the_geom, b.the_geom) AND b.nome = 'SANTO AGOSTINHO' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Quais logradouros que se cruzam com os limites do “LOTEAMENTO VOLTA GRANDE - 3 ETAPA” ? | |
select log.nome from trecho_logradouroS log, loteamentos lot | |
where st_crosses(log.the_geom, lot.the_geom) and lot.nome = 'LOTEAMENTO VOLTA GRANDE - 3 ETAPA' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT sum(st_area(e.the_geom)) AS total_ed FROM edificacao e, loteamentos l | |
WHERE st_disjoint(e.the_geom, l.the_geom) AND l.nome = 'LOTEAMENTO JARDIM IMPERIAL' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT sum(st_area(e.the_geom)) as total_ed FROM edificacao e, loteamentos l | |
WHERE st_intersects(e.the_geom, l.the_geom) AND l.nome = 'LOTEAMENTO JARDIM IMPERIAL' |