So I have a .csv of points that I've cleaned up using pandas, and appended to a list with each item being Type: QgsPoint, with it's correct X and Y coordinate. I'm trying to find the correct operation that can handle this now that it is in a QgsPoint type.
import pandas as pd
from qgis.core import *
import iface
Read in .cas with Transects
df = pd.read_csv("csv link here")
Delete top row with RTC data
dato = df.iloc[1:]
Rename column headers
dato.columns = ['Transect', 'Point Number', 'Subclass', 'Northing', 'Easting', 'Altitude', 'Notes']
print(dato.head())
Create empty list to store point data
PointList = []
Create point for each row based on Northing and Easting data
for index, row in dato.iterrows():
termino = QgsPoint(float(row['Easting']), float(row['Northing']))
PointList.append(termino)
print(PointList)
Here is where I have gotten to. I've tried a few forms of iface.addVectorLayer (which appears to be outdated because iface does not have addVectorLayer apparently), QgsGeometry.fromPolyLine/fromMultipoint both have no worked due to lack of documentation about what each argument is for. I've tried the following:
line = QgsGeometry.fromPolyline(PointList)
QgsGeometry.fromMultiPointXY(PointList)
feat = QgsFeature()
feat.setGeometry(QgsGeometry.fromPoint(PointList[]))
The last attempt says QgsGeometry had no module named fromPoint.
I'm mostly just looking for someone to point me towards a module I should use to get a list of QgsPoints to a shapefile, so I can eventually run Points to Path. All of it will eventually be transferred to Jupyter Notebooks so data can be input and these polygons we need can be spit back out.
line = QgsGeometry.fromPolyline(PointList)andfeat.setGeometry(line)– Andreas Müller Jun 17 '20 at 15:01