Doctrine\MongoDB\Query\Expr::geoWithinPolygon PHP Method

geoWithinPolygon() public method

Point coordinates are in x, y order (easting, northing for projected coordinates, longitude, latitude for geographic coordinates). The last point coordinate is implicitly connected with the first. Note: the $polygon operator only supports legacy coordinate pairs and 2d indexes. This cannot be used with 2dsphere indexes and GeoJSON shapes.
See also: Builder::geoWithinPolygon()
See also: http://docs.mongodb.org/manual/reference/operator/polygon/
public geoWithinPolygon ( )
    public function geoWithinPolygon()
    {
        if (func_num_args() < 3) {
            throw new InvalidArgumentException('Polygon must be defined by three or more points.');
        }
        $shape = ['$polygon' => func_get_args()];
        return $this->operator('$geoWithin', $shape);
    }

Usage Example

Example #1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testGeoWithinPolygonRequiresAtLeastThreePoints()
 {
     $expr = new Expr();
     $expr->geoWithinPolygon(array(0, 0), array(1, 1));
 }
All Usage Examples Of Doctrine\MongoDB\Query\Expr::geoWithinPolygon