Код: Выделить всё
LSKPR=None
for lyr in QgsMapLayerRegistry.instance().mapLayers().values():
if lyr.name() == "LI_DATA_LSKPR":
LSKPR = lyr
break
outputs_QGISEXTRACTNODES_1=processing.runalg('qgis:extractnodes', LSKPR,None)
LSK=None
for lyr in QgsMapLayerRegistry.instance().mapLayers().values():
if lyr.name() == "LI_DATA_LSK":
LSK = lyr
break
outputs_QGISEXTRACTNODES_3=processing.runalg('qgis:extractnodes', LSK,None)
temp_lsk = QgsVectorLayer(outputs_QGISEXTRACTNODES_3['OUTPUT'], "temp_lsk", "ogr")
QgsMapLayerRegistry.instance().addMapLayer(temp_lsk)
output_file = open('d:/nodes.txt', 'w')
list_x = []
list_y = []
list_point = []
for f in temp_lsk.getFeatures():
geom = f.geometry()
x = geom.asPoint().x()
y = geom.asPoint().y()
list_x.append(x)
list_y.append(y)
Num1 = 0
i = 0
while True:
X = list_x[i]
i+=1
Y = list_y[i]
Num1 = Num1 + (X * Y)
if i == len(list_x) - 1:
break
Num2 = 0
i = 0
while True:
Y = list_y[i]
i+=1
X = list_x[i]
Num2 = Num2 + (Y * X)
if i == len(list_y) - 1:
break
double_area = (Num1 - Num2) / 2
if double_area > 0:
list_x.reverse()
list_y.reverse()
i = 0
while True:
X = list_x[i]
Y = list_y[i]
# Feature = QgsPoint(X,Y)
list_point.append(y)
if i == len(list_x) - 1:
break
QgsMapLayerRegistry.instance().removeMapLayer(temp_lsk)
Код: Выделить всё
while True:
X = list_x[i]
Y = list_y[i]
# Feature = QgsPoint(X,Y)
list_point.append(y)
if i == len(list_x) - 1:
break