hi... i try but have this error
Consola de Python
Usa iface para acceder a la interfaz de la API de QGIS o digita help(iface) para más información
Aviso de advertencia: digitar instrucciones desde una fuente no confiable puede conllevar a pérdida o fuga de datos
# -*- coding: utf-8 -*-
import json
from PyQt5.QtGui import QColor, QFont
from qgis.core import QgsPalLayerSettings, QgsTextFormat
from qgis.core import QgsTextBufferSettings, QgsVectorLayerSimpleLabeling
def turnOnLabels(layer, expression):
layer_settings = QgsPalLayerSettings()
text_format = QgsTextFormat()
text_format.setFont(QFont("Arial", 10))
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
text_format.setFont(QFont("Arial", 10))
^
IndentationError: unexpected indent
text_format.setSize(10)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
text_format.setSize(10)
^
IndentationError: unexpected indent
buffer_settings = QgsTextBufferSettings()
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
buffer_settings = QgsTextBufferSettings()
^
IndentationError: unexpected indent
buffer_settings.setEnabled(True)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
buffer_settings.setEnabled(True)
^
IndentationError: unexpected indent
buffer_settings.setSize(0.10)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
buffer_settings.setSize(0.10)
^
IndentationError: unexpected indent
buffer_settings.setColor(QColor("black"))
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
buffer_settings.setColor(QColor("black"))
^
IndentationError: unexpected indent
text_format.setBuffer(buffer_settings)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
text_format.setBuffer(buffer_settings)
^
IndentationError: unexpected indent
layer_settings.setFormat(text_format)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.setFormat(text_format)
^
IndentationError: unexpected indent
layer_settings.fieldName = expression
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.fieldName = expression
^
IndentationError: unexpected indent
layer_settings.isExpression = True
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.isExpression = True
^
IndentationError: unexpected indent
layer_settings.placement = 4
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.placement = 4
^
IndentationError: unexpected indent
layer_settings.enabled = True
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.enabled = True
^
IndentationError: unexpected indent
layer_settings = QgsVectorLayerSimpleLabeling(layer_settings)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings = QgsVectorLayerSimpleLabeling(layer_settings)
^
IndentationError: unexpected indent
layer.setLabelsEnabled(True)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer.setLabelsEnabled(True)
^
IndentationError: unexpected indent
layer.setLabeling(layer_settings)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer.setLabeling(layer_settings)
^
IndentationError: unexpected indent
layer.triggerRepaint()
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer.triggerRepaint()
^
IndentationError: unexpected indent
input_file_path = unicode(r"C:\Users\NL01031\Downloads\Seguimiento Rio Salado.json")
groupName ="Annotations"
project = QgsProject.instance()
root = project.layerTreeRoot()
group = root.addGroup(groupName)
lineLayer = QgsVectorLayer("linestring?crs=epsg:4326&field=id:string(36)&field=title:string&field=description:string&index=yes", "PolyLines", "memory")
project.addMapLayer(lineLayer, False)
<QgsMapLayer: 'PolyLines' (memory)>
group.addLayer(lineLayer)
<qgis._core.QgsLayerTreeLayer object at 0x0000026B79645DC8>
pointLayer = QgsVectorLayer("point?crs=epsg:4326&field=id:string(36)&field=title:string&field=description:string&field=textvalue:string&&index=yes", "Points", "memory")
project.addMapLayer(pointLayer, False)
<QgsMapLayer: 'Points' (memory)>
group.addLayer(pointLayer)
<qgis._core.QgsLayerTreeLayer object at 0x0000026B79645DC8>
polygonLayer = QgsVectorLayer("polygon?crs=epsg:4326&field=id:string(36)&field=title:string&field=description:string&index=yes", "Polygons", "memory")
project.addMapLayer(polygonLayer, False)
<QgsMapLayer: 'Polygons' (memory)>
group.addLayer(polygonLayer)
<qgis._core.QgsLayerTreeLayer object at 0x0000026B79645DC8>
annotationFile = open(input_file_path)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\NL01031\\Downloads\\Seguimiento Rio Salado.json'
annotations = json.loads(annotationFile.read())
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
NameError: name 'annotationFile' is not defined
features = annotations['features']
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
NameError: name 'annotations' is not defined
for feature in features:
attributeId = feature['properties']['id']
attributeTitle = feature['properties']['title']
try:
attributeDescription = feature['properties']['description']
except KeyError:
attributeDescription = None
subParts = feature['features']
for subPart in subParts:
featureType = subPart['geometry']['type']
if featureType == 'LineString':
vertices = []
for coord in subPart['geometry']['coordinates']:
vertex = QgsPoint(coord[0], coord[1])
vertices.append(vertex)
geom = QgsGeometry.fromPolyline(vertices)
feat = QgsFeature(lineLayer.fields())
elif featureType == 'Point':
coord = subPart['geometry']['coordinates']
pointXY = QgsPointXY(coord[0], coord[1])
geom = QgsGeometry.fromPointXY(pointXY)
feat = QgsFeature(pointLayer.fields())
try:
attributeTextValue = subPart['properties']['valueText']
except KeyError:
attributeTextValue = ''
feat.setAttribute('textvalue', attributeTextValue)
elif featureType == 'Polygon':
vertices = []
for coord in subPart['geometry']['coordinates'][0]:
vertex = QgsPointXY(coord[0], coord[1])
vertices.append(vertex)
geom = QgsGeometry.fromPolygonXY([vertices])
geom.addRing(vertices)
feat = QgsFeature(polygonLayer.fields())
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
NameError: name 'features' is not defined
feat.setGeometry(geom)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
feat.setGeometry(geom)
^
IndentationError: unexpected indent
feat.setAttribute('id', attributeId)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
feat.setAttribute('id', attributeId)
^
IndentationError: unexpected indent
feat.setAttribute('title', attributeTitle)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
feat.setAttribute('title', attributeTitle)
^
IndentationError: unexpected indent
feat.setAttribute('description', attributeDescription)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
feat.setAttribute('description', attributeDescription)
^
IndentationError: unexpected indent
if featureType == 'LineString':
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
if featureType == 'LineString':
^
IndentationError: unexpected indent
(res, outFeats) = lineLayer.dataProvider().addFeatures([feat])
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
(res, outFeats) = lineLayer.dataProvider().addFeatures([feat])
^
IndentationError: unexpected indent
elif featureType == 'Point':
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
elif featureType == 'Point':
^
IndentationError: unexpected indent
(res, outFeats) = pointLayer.dataProvider().addFeatures([feat])
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
(res, outFeats) = pointLayer.dataProvider().addFeatures([feat])
^
IndentationError: unexpected indent
elif featureType == 'Polygon':
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
elif featureType == 'Polygon':
^
IndentationError: unexpected indent
(res, outFeats) = polygonLayer.dataProvider().addFeatures([feat])
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
(res, outFeats) = polygonLayer.dataProvider().addFeatures([feat])
^
IndentationError: unexpected indent
turnOnLabels(pointLayer, '"title" || \' - \' || "textvalue"')
turnOnLabels(lineLayer, '"title"')
# -*- coding: utf-8 -*-
import json
from PyQt5.QtGui import QColor, QFont
from qgis.core import QgsPalLayerSettings, QgsTextFormat
from qgis.core import QgsTextBufferSettings, QgsVectorLayerSimpleLabeling
def turnOnLabels(layer, expression):
layer_settings = QgsPalLayerSettings()
text_format = QgsTextFormat()
text_format.setFont(QFont("Arial", 10))
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
text_format.setFont(QFont("Arial", 10))
^
IndentationError: unexpected indent
text_format.setSize(10)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
text_format.setSize(10)
^
IndentationError: unexpected indent
buffer_settings = QgsTextBufferSettings()
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
buffer_settings = QgsTextBufferSettings()
^
IndentationError: unexpected indent
buffer_settings.setEnabled(True)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
buffer_settings.setEnabled(True)
^
IndentationError: unexpected indent
buffer_settings.setSize(0.10)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
buffer_settings.setSize(0.10)
^
IndentationError: unexpected indent
buffer_settings.setColor(QColor("black"))
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
buffer_settings.setColor(QColor("black"))
^
IndentationError: unexpected indent
text_format.setBuffer(buffer_settings)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
text_format.setBuffer(buffer_settings)
^
IndentationError: unexpected indent
layer_settings.setFormat(text_format)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.setFormat(text_format)
^
IndentationError: unexpected indent
layer_settings.fieldName = expression
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.fieldName = expression
^
IndentationError: unexpected indent
layer_settings.isExpression = True
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.isExpression = True
^
IndentationError: unexpected indent
layer_settings.placement = 4
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.placement = 4
^
IndentationError: unexpected indent
layer_settings.enabled = True
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings.enabled = True
^
IndentationError: unexpected indent
layer_settings = QgsVectorLayerSimpleLabeling(layer_settings)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer_settings = QgsVectorLayerSimpleLabeling(layer_settings)
^
IndentationError: unexpected indent
layer.setLabelsEnabled(True)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer.setLabelsEnabled(True)
^
IndentationError: unexpected indent
layer.setLabeling(layer_settings)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer.setLabeling(layer_settings)
^
IndentationError: unexpected indent
layer.triggerRepaint()
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
layer.triggerRepaint()
^
IndentationError: unexpected indent
input_file_path = unicode(r"C:\Users\oscar\Downloads\Seguimiento Rio Salado.json")
groupName ="Annotations"
project = QgsProject.instance()
root = project.layerTreeRoot()
group = root.addGroup(groupName)
lineLayer = QgsVectorLayer("linestring?crs=epsg:4326&field=id:string(36)&field=title:string&field=description:string&index=yes", "PolyLines", "memory")
project.addMapLayer(lineLayer, False)
<QgsMapLayer: 'PolyLines' (memory)>
group.addLayer(lineLayer)
<qgis._core.QgsLayerTreeLayer object at 0x0000026B79645EE8>
pointLayer = QgsVectorLayer("point?crs=epsg:4326&field=id:string(36)&field=title:string&field=description:string&field=textvalue:string&&index=yes", "Points", "memory")
project.addMapLayer(pointLayer, False)
<QgsMapLayer: 'Points' (memory)>
group.addLayer(pointLayer)
<qgis._core.QgsLayerTreeLayer object at 0x0000026B79645F78>
polygonLayer = QgsVectorLayer("polygon?crs=epsg:4326&field=id:string(36)&field=title:string&field=description:string&index=yes", "Polygons", "memory")
project.addMapLayer(polygonLayer, False)
<QgsMapLayer: 'Polygons' (memory)>
group.addLayer(polygonLayer)
<qgis._core.QgsLayerTreeLayer object at 0x0000026B79645B88>
annotationFile = open(input_file_path)
annotations = json.loads(annotationFile.read())
features = annotations['features']
for feature in features:
attributeId = feature['properties']['id']
attributeTitle = feature['properties']['title']
try:
attributeDescription = feature['properties']['description']
except KeyError:
attributeDescription = None
subParts = feature['features']
for subPart in subParts:
featureType = subPart['geometry']['type']
if featureType == 'LineString':
vertices = []
for coord in subPart['geometry']['coordinates']:
vertex = QgsPoint(coord[0], coord[1])
vertices.append(vertex)
geom = QgsGeometry.fromPolyline(vertices)
feat = QgsFeature(lineLayer.fields())
elif featureType == 'Point':
coord = subPart['geometry']['coordinates']
pointXY = QgsPointXY(coord[0], coord[1])
geom = QgsGeometry.fromPointXY(pointXY)
feat = QgsFeature(pointLayer.fields())
try:
attributeTextValue = subPart['properties']['valueText']
except KeyError:
attributeTextValue = ''
feat.setAttribute('textvalue', attributeTextValue)
elif featureType == 'Polygon':
vertices = []
for coord in subPart['geometry']['coordinates'][0]:
vertex = QgsPointXY(coord[0], coord[1])
vertices.append(vertex)
geom = QgsGeometry.fromPolygonXY([vertices])
geom.addRing(vertices)
feat = QgsFeature(polygonLayer.fields())
1012
1012
1012
1012
1012
feat.setGeometry(geom)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
feat.setGeometry(geom)
^
IndentationError: unexpected indent
feat.setAttribute('id', attributeId)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
feat.setAttribute('id', attributeId)
^
IndentationError: unexpected indent
feat.setAttribute('title', attributeTitle)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
feat.setAttribute('title', attributeTitle)
^
IndentationError: unexpected indent
feat.setAttribute('description', attributeDescription)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
feat.setAttribute('description', attributeDescription)
^
IndentationError: unexpected indent
if featureType == 'LineString':
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
if featureType == 'LineString':
^
IndentationError: unexpected indent
(res, outFeats) = lineLayer.dataProvider().addFeatures([feat])
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
(res, outFeats) = lineLayer.dataProvider().addFeatures([feat])
^
IndentationError: unexpected indent
elif featureType == 'Point':
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
elif featureType == 'Point':
^
IndentationError: unexpected indent
(res, outFeats) = pointLayer.dataProvider().addFeatures([feat])
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
(res, outFeats) = pointLayer.dataProvider().addFeatures([feat])
^
IndentationError: unexpected indent
elif featureType == 'Polygon':
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
elif featureType == 'Polygon':
^
IndentationError: unexpected indent
(res, outFeats) = polygonLayer.dataProvider().addFeatures([feat])
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
(res, outFeats) = polygonLayer.dataProvider().addFeatures([feat])
^
IndentationError: unexpected indent
turnOnLabels(pointLayer, '"title" || \' - \' || "textvalue"')
turnOnLabels(lineLayer, '"title"')