Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567



Laravel Geographical Calculator | Laravel News

Laravel Geographical Calculator helps you implement geographical calculation with several algorithms that help you deal with coordinates.

This package has two primary uses: getting the distance between a set of coordinates and getting the center between two or more coordinates.

First, here’s an example of getting the distance between multiple sets of latitude and longitude points. The GeoFacade accepts various sets of points and calculates the distance between point one and point two, then points two and three, and so on.

1use KMLaravelGeographicalCalculatorFacadeGeoFacade;


3$distance = GeoFacade::setPoint([22, 37])

4 ->setOptions(['units' => ['km']])

5 // you can set unlimited lat/long points.

6 ->setPoint([33, 40])

7 // get the calculated distance between each point

8 ->getDistance();

You can get the center between two sets of lat/long points using the getCenter() method. Like the getDistance() method, you can call setPoint() multiple times and it will calculate the center of multiple sets of points:

1// Get the calculated center between these points.

2$center = GeoFacade::setPoint([22, 37])

3 // you can set unlimited points.

4 ->setPoint([33, 40])

5 ->getCenter();

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Credit: Source link

Previous Next
Test Caption
Test Description goes like this