In modern times, many ships use onboard GPS systems to determine latitude and longitude. Previously, sailors used a sextant to determine the latitude of a ship.
In ancient times, sailors embarking on long voyages measured the distance of Polaris, the North Star, above the horizon at their homeport. When they wanted to return to port, they sailed north or south until Polaris was the same height above the horizon and then east or west to return to port.
Sailors developed a better measuring device, called a kamal. A kamal is a string tied to a piece of wood. A sailor set the bottom edge of the wood to the horizon and the top edge on Polaris. He then tied a knot in the string to mark the distance from the wood to his mouth. When he wished to return to the same latitude, he placed the knot in his mouth and sailed northward or southward until the wood filled the space between the horizon and Polaris.
In the 10th century, Arabs introduced the quadrant and the astrolabe. A quadrant measures angles up to 90 degrees much more precisely than a kamal. An astrolabe is used to find the time or rising or setting celestial objects.
Sextants, which precisely measures the angle between two objects, were invented in the 18th century.