hector68/mkad-google-distance

There is no license information available for the latest version (dev-master) of this package.

dev-master 2018-01-05 11:07 UTC

This package is not auto-updated.

Last update: 2024-12-22 06:07:11 UTC


README

... или других объектов

Использование

Через Google APi

  $provider = new GoogleDistanceProvider($key);
            $mkad         = new MkadPolygon();
            $pointOutMkad = new Point(55.731727, 36.851284);
            $distance = DistanceHelper::getDistance($pointOutMkad, $mkad, $provider);
            $this->assertTrue($distance > 0);
            $pointInMkad = new Point(55.705485, 37.673276);
            $distance    = DistanceHelper::getDistance($pointInMkad, $mkad, $provider);
            $this->assertTrue($distance === 0);

Определять расстояние напрямую

 $provider = new DirectDistanceProvider();
        $mkad         = new MkadPolygon();
        $pointOutMkad = new Point(55.731727, 36.851284);
        $distance = DistanceHelper::getDistance($pointOutMkad, $mkad, $provider);
        $this->assertTrue($distance > 0);
        $pointInMkad = new Point(55.705485, 37.673276);
        $distance    = DistanceHelper::getDistance($pointInMkad, $mkad, $provider);
        $this->assertTrue($distance === 0);