I have two Python list latitude
and longitude
which stores the coordinates, and I want to draw a single line from the list coordinates.
I can draw the line if I know the number of latitude/longitude.
# suppose the line is having 2 longitudes and 2 latitudes.
QgsFeature().setGeometry(QgsGeometry.fromPolylineXY([QgsPointXY(78.3022187,23.7875547),QgsPointXY(98.3022187,33.7875547)]))
# suppose the line is having 3 longitudes and 3 latitudes.
QgsFeature().setGeometry(QgsGeometry.fromPolylineXY([QgsPointXY(78.3022187,23.7875547),QgsPointXY(98.3022187,33.7875547),QgsPointXY(148.3022187,133.7875547)]))
How can I draw a line in QGIS through Python, for the variable number of points?