Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two points:


but when I run:


it returns False. What am I doing wrong?


it returns True when I only use:

share|improve this question
up vote 3 down vote accepted

Instead of using ==, just use the following command:


a.equals(b)    # -> returns True

Regarding to the comments on this answer:

 a = QgsPoint(227739,908343)
 b = QgsPoint(227739,908343)
 a == b # TRUE
 aa = QgsGeometry.fromPoint(a)
 bb = QgsGeometry.fromPoint(b)
 aa.equals(bb) # TRUE

Try to investigate the type of your points (are they really QgsPoints?) and if it still doesn't work, than compare the values manually

a.x() == b.x()
share|improve this answer
on a (un)related note,can you help me with this too? 'qaz[0] (227739,908343) type(qaz[0]) <class 'qgis.core.QgsPoint'> wxs[0] (227739,908343) type(wxs[0]) <class 'qgis.core.QgsPoint'> qaz[0]==wxs[0] False' – PeterBorook Apr 2 '13 at 18:18
so what is the output of qaz[0].equals(wxs[0]) ? – Curlew Apr 2 '13 at 18:23
AttributeError: 'QgsPoint' object has no attribute 'equals' – PeterBorook Apr 2 '13 at 18:23
so add the same code before your point to get a QgsGeometry Object --> a = QgsGeometry.fromPoint(qaz[0]) – Curlew Apr 2 '13 at 18:25
>>> q= QgsGeometry.fromPoint(qaz[0]) >>> w= QgsGeometry.fromPoint(wxs[0]) q.equals(w) False – PeterBorook Apr 2 '13 at 18:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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