Location\Polygon::getLats PHP Method

getLats() public method

Return all polygon point's latitudes.
public getLats ( ) : float[]
return float[]
    public function getLats()
    {
        $lats = [];
        foreach ($this->points as $point) {
            $lats[] = $point->getLat();
        }
        return $lats;
    }

Usage Example

Beispiel #1
0
 public function testIfGetLatsWorksAsExpected()
 {
     $polygon = new Polygon();
     $polygon->addPoint(new Coordinate(10, 20));
     $polygon->addPoint(new Coordinate(10, 40));
     $polygon->addPoint(new Coordinate(30, 40));
     $polygon->addPoint(new Coordinate(30, 20));
     $expected = array(10, 10, 30, 30);
     $this->assertEquals($expected, $polygon->getLats());
 }