1

I have two point layer in my Project Centroid.shp and Nodes.shp.I have used Distance Matrix to find nearest Nodes point from Centroid Point. I have saved the output in FinalDistance.csv. The FinalDistance.csv contain centroid point number, node point number and distance. No other X and Y coordinates of any of the point layer is stored in csv file. but later I realized I need to do some Sql processing in this final distance, so I tried to save as memory layer. But I couldn't get this memory layer in my Layers Panel. However when I execute manually I always get "FinalDistance" named memory layer in panel. Or is there any way of importing csv file without having x and y cordiantes info in it.

   processing.run("qgis:distancematrix",{ 'INPUT' : 'C:/Final Demand Allocation/centroid.shp', 'INPUT_FIELD' : 'HMINNODE', 'TARGET' : 'C:/Final Demand Allocation/Test/Proposed_Nodes.shp', 'TARGET_FIELD' : 'id', 'MATRIX_TYPE' : 0, 'NEAREST_POINTS' : 1, 'OUTPUT' : 'memory:' })
1

I can add a csv File in my layer panel without any Geometry Coordinates (Only Attribute Table ).

  uri = "file:///C:/Final Demand Allocation/finalDistance.csv?delimiter=,&crs=epsg:4326"
  vlayer = QgsVectorLayer(uri,'finalDistance','delimitedtext')
  QgsProject.instance().addMapLayer(vlayer)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.