# How to use tinygps.h library to measure distance? using NEO6mv2

Arduino Asked by Reiniel Cirujano Antonio on September 25, 2021

any reference site for the format code for tinygps.h to measure distance?
or any codes for tinygps.h for measuring distance i’m just a beginner in learning arduino thank you

You don't use the tinygps.h library to measure distance. You use the tinygps.h library to get coordinates. Over short distances those coordinates (longitude and latitude) can be equated to x,y coordinates on a plane (over greater distance - hundreds or thousands of miles - it gets a whole lot more complex).

Two sets of x,y coordinates form a line. A line is one side of a right-angled triangle (the hypotenuse).

Pythagoras (remember him from math class? That rubbish you thought you'd never need? Well, now you do...) says that the square of the hypotenuse is equal to the sum of the squares of the other two sides.

You know the other two sides - they're just the difference between the two x coordinates and the two y coordinates.

We're not going to write the code for you, and Google is probably better at finding websites with example code on than we are.

Answered by Majenko on September 25, 2021