# Distance between two points on QGIS 3.4.7 and Python 3.7

I am under the 2154 CRS (RGF 93). I want to calculate the distance in meters between two point knowing their coordinates.

Let's consider two points : A(474828.85, 6756169.31) and B(874895.75, 6756159.5) If I measure the distance manualy I get 69.6m.

I want to get this result through the Python console. I have read two ways of doing it: QGIS Python Distance between points

Nevertheless, it fails on my case.

``````>>>point1 = QgsPoint(474828.85, 6756169.31)
>>>point2 = QgsPoint(874895.75, 6756159.5)
>>>distance = QgsDistanceArea()
``````

This is ok, but the next line sends an error message:

``````>>>m = distance.measureLine(point1, point2)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
TypeError: QgsDistanceArea.measureLine(): arguments did not match any overloaded call:
overload 1: argument 1 has unexpected type 'QgsPoint'
overload 2: argument 1 has unexpected type 'QgsPoint'
``````

The other method presented in the link fails too: My question is : "How can I get the distance given in meters ?"

This method expect point in latitude/longitude.

https://qgis.org/api/classQgsDistanceArea.html

Your coordinates are projected, so you can just do

``````point1 = QgsPoint(474828.85, 6756169.31)
point2 = QgsPoint(874895.75, 6756159.5)
distance = point1.distance(point2)
``````

https://qgis.org/api/classQgsPoint.html

The API says measureLine is expecting QgsPointXY. https://qgis.org/api/classQgsDistanceArea.html#a732e4348b96388df6255f981a2bc0ca4

``````point1 = QgsPointXY(474828.85, 6756169.31)
point2 = QgsPointXY(874895.75, 6756159.5)
distance = QgsDistanceArea()
m = distance.measureLine(point1, point2)
``````
• I tried your way but get this error message:Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\code.py", line 90, in runcode exec(code, self.locals) File "<input>", line 1, in <module> TypeError: QgsDistanceArea.measureLine(): arguments did not match any overloaded call: overload 1: argument 1 has unexpected type 'QgsPoint' overload 2: argument 1 has unexpected type 'QgsPoint' – Basile May 27 '19 at 7:45