# Quickstart Tutorial¶

Please ensure you have completed the installation instructions for the Navigator library before continuing with these quickstart tutorials.

## Super Simple Example¶

This is the easiest way to get a quick distance between two points of the Earth in metres.

```<?php
use Treffynnon\Navigator as N;
\$distance = N::getDistance(10, 81.098, 15.6, '5° 10\' 11.009"W');
```

The function takes a sequence of latitude and longitude values:

`N::getDistance(lat1, long1, lat2, long2)`

Returns the distance in metres between the supplied points on Earth

Parameters: lat1 (string or float) – The latitude of point 1 long1 (string or float) – The longitude of point 1 lat2 (string or float) – The latitude of point 2 long2 (string or float) – The longitude of point 2 float

## A Slightly More Advanced Example¶

To get more control over the setup of the distance calculation you can make use of the distance factory. The following snippet will give the \$distance using the Haversine formula and converted to parsecs.

```<?php
use Treffynnon\Navigator as N;
use Treffynnon\Navigator\Distance\Calculator\Haversine as H;
use Treffynnon\Navigator\Distance\Converter\MetreToParsec as P;
\$Distance = N::distanceFactory(10, 81.098, 15.6, '5° 10\' 11.009"W');
\$distance = \$Distance->get(new H, new P);
```
`N::distanceFactory(lat1, long1, lat2, long2)`

Get a distance instance pre-populated with the supplied sequence of latitude and longitude values

Parameters: lat1 (string or float) – The latitude of point 1 long1 (string or float) – The longitude of point 1 lat2 (string or float) – The latitude of point 2 long2 (string or float) – The longitude of point 2 TreffynnonNavigatorDistance