I need to load geometry from csv and then use it to calculate hub distance. I write the following script, but it doesn't work. What am I doing wrong?
sys.path.append('/usr/share/qgis/python/plugins/')
from processing.core.Processing import Processing
from processing.tools import *
qgs = QgsApplication([], True)
QgsApplication.setPrefixPath("/usr", True)
Processing.initialize()
QgsApplication.initQgis()
layer = QgsVectorLayer('from_excel.csv', 'from_excel', "delimitedtext")
layer.setCrs(QgsCoordinateReferenceSystem(32365, QgsCoordinateReferenceSystem.EpsgCrsId))
layer2 = QgsVectorLayer('/home/raven/work/UpWork/Inputs/Cenefas.shp', 'Cenefas', 'ogr')
layer2.setCrs(QgsCoordinateReferenceSystem(32365, QgsCoordinateReferenceSystem.EpsgCrsId))
general.runalg("qgis:distancetonearesthub", layer, layer2, 'test', 0, 0, 'HubOutput')
QgsApplication.exitQgis()
Then I've bunch or errors:
- Warning: Not all input layers use the same CRS.
- Fields of width 255 truncated to 254 'NoneType' object has no attribute 'boundingBox'
- Segmentation fault (core dumped)