I'm new to PyQGIS so here goes: Give a new QGIS project, how can we draw some Points on the map?
I tried the following but nothing showed up. Should they be placed in a Vector layer before they can be rendered?
line_start = QgsPoint(50,50)
line_end = QgsPoint(100,150)
line = QgsGeometry.fromPolyline([line_start,line_end])
Update
from PyQt4.QtCore import QVariant
lineLayer = QgsVectorLayer("LineString", 'test layer', "memory")
lineLayer.startEditing()
layerData = lineLayer.dataProvider()
layerData.addAttributes([ QgsField("ID", QVariant.String), QgsField("latStart", QVariant.String), QgsField("lonStart", QVariant.String), QgsField("latEnd", QVariant.String), QgsField("lonEnd", QVariant.String) ])
lineLayer.commitChanges()
QgsMapLayerRegistry.instance().addMapLayer(lineLayer)
This code created a layer but nothing appears on the map even after using the Zoom to layer
function on that layer.