I came across the same issue last week. Follow this work flow and you'll be able to see selected points, even if they share position with non-selected points:
- Load your point layer in QGIS and make sure it is in the first position of the ToC.
- Open the Python Console from Menu Plugins.
- Copy the next Python code in the Python console and press Enter (you might need to press Enter a couple of times until you get the "True" line).
from qgis.gui import QgsVertexMarker
from PyQt4.QtGui import QColor
from PyQt4 import QtCore
layer = iface.mapCanvas().layers()[0]
vertices = []
def showSelectedPoints():
selected = layer.selectedFeatures()
for f in selected:
vertex = QgsVertexMarker( iface.mapCanvas() )
vertex.setCenter( f.geometry().asPoint() )
vertex.setColor( QColor(255,0,0) )
vertex.setIconType( 3 ) # ICON_BOX
vertex.setIconSize( 12 )
vertex.setPenWidth( 2 )
vertices.append( vertex )
def removeSel():
for v in vertices:
iface.mapCanvas().scene().removeItem( v )
del v
def updateSelection():
removeSel()
showSelectedPoints()
QtCore.QObject.connect( layer, QtCore.SIGNAL("selectionChanged()"), updateSelection)
- Open the attribute table and select some rows.
You should see a red box on every selected point. Every time you update the selection, the red boxes should appear/disappear accordingly.
If you don't like boxes or the color red, you could edit the methods setColor and setIconType on the code above and copy it again to the Python Console.
Please give it a try and tell me if something is unclear for you.