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
sym = QgsLineSymbolV2.createSimple({}) | |
r = QgsRuleBasedRendererV2(sym) | |
sym2 = QgsLineSymbolV2.createSimple({}) | |
exp = "sewer_type = 'Pipe'" | |
rule = QgsRuleBasedRendererV2.Rule(sym2, filterExp=exp) | |
r.rootRule().appendChild(rule) | |
iface.activeLayer().setRendererV2(r) |
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
def complete_projects(argname, data): | |
# TODO Add auto complete for paths | |
projects = [] | |
for path in project_paths: | |
projects += [os.path.basename(f) for f in glob.glob(path + "/*.qgs")] | |
return projects | |
@command.command("Name") | |
@command.complete_with(name=complete_projects) | |
def load_project(name): |
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
# Command bar init file. Lines starting with # are ignored | |
alias lp load-project | |
alias @ alias |
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
import re | |
from qgis.core import QgsMapLayerRegistry | |
from qgis.utils import iface | |
from qgiscommand.command import command, complete_with, check | |
from qgiscommand.qgis_commands import layer_by_name, layers | |
def layer_exists(data): | |
try: | |
layer_by_name(data) |
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
from qgis.utils import iface | |
from qgis.core import QGis | |
from qgiscommand.command import command | |
@command() | |
def bbox(): | |
layer = iface.activeLayer() | |
def pbounds (Lextent,s): | |
e = Lextent |
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
import os | |
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
outdir = '~/temp/' | |
size = QSize(32, 32) | |
def get_gen(name): | |
gen = QSvgGenerator() |
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
from PyQt4.QtCore import QThread, QObject, pyqtSignal | |
import time | |
class Worker(QObject): | |
done = pyqtSignal() | |
finalResult = pyqtSignal(int) | |
def __init__(self, parent=None): | |
super(Worker, self).__init__(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
public class Outlook | |
{ | |
private Application outlook; | |
private Outlook(Application outlookInstance) | |
{ | |
this.outlook = outlookInstance; | |
this.DBYDEmailFolderName = "DBYD"; | |
} | |
public static Outlook ConnectToOutlook() |
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
import qgis.core | |
import qgis.gui | |
def TestWrite(iface): | |
can = iface.mapCanvas() | |
layer = can.currentLayer() | |
geom = layer.selectedFeatures()[1].geometry() | |
return geom.length() |
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
def run(): | |
layer = qgis.utils.iface.mapCanvas().currentLayer() | |
for feature in layer.selectedFeatures(): | |
geom = feature.geometry() | |
nodes = geom.asPolyline() | |
print nodes | |
nodes.reverse() | |
print nodes | |
newgeom = QgsGeometry.fromPolyline(nodes) | |
print newgeom |