Guest User

Untitled

a guest
May 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. exec(open('C:/Arundhati/Automation Test Script/Radio Signal/QGIS_Test.py'.encode('utf-8')).read())
  2. Traceback (most recent call last):
  3. File "C:PROGRA~1QGIS3~1.0appsPython36libcode.py", line 91, in runcode
  4. exec(code, self.locals)
  5. File "<input>", line 1, in <module>
  6. File "<string>", line 12, in <module>
  7. AttributeError: 'QgsVectorLayer' object has no attribute 'layer'
  8.  
  9. from qgis.core import *
  10. import qgis.utils
  11. import sys
  12.  
  13. QgsApplication.setPrefixPath("C:/Program Files/QGIS 3.0", True)
  14. qgs = QgsApplication([], False) ###
  15. qgs.initQgis() ###
  16.  
  17. _layer1 = QgsVectorLayer("C:/Arundhati/Automation Test Script/Radio Signal/SIGNAL.shp", "SIGNAL", "ogr")
  18.  
  19. print("I am here" + _layer1.layer.wkbType())
  20.  
  21.  
  22. _writer1 = QgsVectorFileWriter("C:/Arundhati/Automation Test Script/Radio Signal/SIGNAL.shp", 'utf-8', _layer1.fields(),Qgis.WKBPoint,QgsCoordinateReferenceSystem(),'ESRI Shapefile')
  23.  
  24. #add a feature
  25. fet = QgsFeature()
  26. fet.setGeometry(QgsGeometry.fromPoint(QgsPoint(10,10)))
  27. fet.setAttributes([1,"text"])
  28. _writer1.addFeature(fet)
  29.  
  30. del _writer1
  31.  
  32. qgs.exitQgis()
Add Comment
Please, Sign In to add comment