chore(Query): $withinPolygon: 3 point minimum and boundary testing. (#3889)
* added 3 point minimum constraint to within-polygon * test nit * test for open and closed paths
This commit is contained in:
committed by
Florent Vilmart
parent
9ad8697c7a
commit
e8be98ded2
@@ -348,7 +348,16 @@ const buildWhereClause = ({ schema, query, index }) => {
|
||||
if (fieldValue.$geoWithin && fieldValue.$geoWithin.$polygon) {
|
||||
const polygon = fieldValue.$geoWithin.$polygon;
|
||||
if (!(polygon instanceof Array)) {
|
||||
throw new Parse.Error(Parse.Error.INVALID_JSON, 'bad $geoWithin value');
|
||||
throw new Parse.Error(
|
||||
Parse.Error.INVALID_JSON,
|
||||
'bad $geoWithin value; $polygon should contain at least 3 GeoPoints'
|
||||
);
|
||||
}
|
||||
if (polygon.length < 3) {
|
||||
throw new Parse.Error(
|
||||
Parse.Error.INVALID_JSON,
|
||||
'bad $geoWithin value; $polygon should contain at least 3 GeoPoints'
|
||||
);
|
||||
}
|
||||
const points = polygon.map((point) => {
|
||||
if (typeof point !== 'object' || point.__type !== 'GeoPoint') {
|
||||
|
||||
Reference in New Issue
Block a user