parse-community / parse-php-sdk

The PHP SDK for Parse Platform
https://parseplatform.org/
Other
811 stars 346 forks source link

withinPolygon? #392

Closed IanCabell closed 6 years ago

IanCabell commented 6 years ago

I'm trying to find locations in the DB within the contiguous United States. To do this, I'm using the query "withinPolygon" and a square around the US. Not exact, but should work :) The response I'm getting is 'bad constraint: $geoWithin'

Curious if anyone else has used the "withinPolygon" query and if there's something I'm doing wrong?

Here's the basic code: $query = new Parse\ParseQuery( "Church" ); $nwCornerContiguous = new Parse\ParseGeoPoint( $top, $left ); $neCornerContiguous = new Parse\ParseGeoPoint( $top, $right ); $swCornerContiguous = new Parse\ParseGeoPoint( $bottom, $left ); $seCornerContiguous = new Parse\ParseGeoPoint( $bottom, $right ); $query->withinPolygon( "locationGeopoint", array( $nwCornerContiguous, $neCornerContiguous, $swCornerContiguous, $seCornerContiguous ) ); $results = $query->find();

dplewis commented 6 years ago

This feature was added to Parse Server 2.5.0. Please update to the latest version.

IanCabell commented 6 years ago

Thank you!