You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GeoQueries running with withinPolygon constraint do not work and return error -1 (Unknown server Error) or 1 (Internal Server Error), either when used with a Polygon such as:
let query = City.query(withinPolygon(key: "location", polygon: myPolygon))
or with an array of GeoPoints such as:
let query = City.query(withinPolygon(key: "location", points: [geoPoint1, geoPoint2, geoPoint3, geoPoint4]))
Steps to reproduce
Parse 4.5.0 running at Back4App
Parse-Swift in the latest version added to the project using SPM
Class with GeoPoint property contained in the area of Polygon or array of GeoPoints
Actual Outcome
Parse Error either Error -1 (Unknown Server Error) or 1 (Internal Server Error)
Message from Debug Print:
Error querying: ParseError code=1 error=Internal server error.
Expected Outcome
A list of objects contained in the current Polygon or GeoPoint Array.
Same code with same coordinates when used with the JS SDK return objects correctly.
Operating system (iOS, macOS, watchOS, etc.): Mac OSX Monterey 12.3.1
Operating system version: 12.3.1
Emulator: iOS 14.0 image
Server
Parse Server version: 4.5.0
Operating system: Linux
Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Back4App
Database
System (MongoDB or Postgres): MongoDB
Database version: 3.6
Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Back4App
Logs
Error querying: ParseError code=1 error=Internal server error.
Code to Reproduce
Assuming you have a Class called "City" which contains a property named "location" that has a valid GeoPoint contained in the Polygon or array of GeoPoints.
The code below uses an array of GeoPoints, but the behavior is the same with a Polygon.
private func withinPolygon_query() {
do {
let geoPoint1 = try ParseGeoPoint(latitude: 90.0, longitude: -180.0)
let geoPoint2 = try ParseGeoPoint(latitude: -90.0, longitude: -180.0)
let geoPoint3 = try ParseGeoPoint(latitude: 90.0, longitude: 180.0)
let geoPoint4 = try ParseGeoPoint(latitude: -90.0, longitude: 180.0)
let query = City.query(withinPolygon(key: "location", points: [geoPoint1, geoPoint2, geoPoint3, geoPoint4]))
query.find { results in
switch results {
case .success(let cities):
cities.forEach { (city) in
print("Found City with objectId \"\(city.objectId!)\"")
}
case .failure(let error):
print("Error querying: \(error)")
}
}
} catch let error as ParseError {
print("Failed to instantiate vertices: \(error.message)")
} catch {
print("Failed to instantiate vertices: \(error.localizedDescription)")
}
}
Same implementation in Node.JS using the JS SDK, which responds correctly with all objects:
async function run(){
let geoPoint1 = new Parse.GeoPoint({latitude: 90.0, longitude: -180.0});
let geoPoint2 = new Parse.GeoPoint({latitude: -90.0, longitude: -180.0});
let geoPoint3 = new Parse.GeoPoint({latitude: 90.0, longitude: 180.0});
let geoPoint4 = new Parse.GeoPoint({latitude: -90.0, longitude: 180.0});
const query = new Parse.Query("City");
query.withinPolygon("location", [geoPoint1, geoPoint2, geoPoint3, geoPoint4]);
const results = await query.find();
results.forEach((result) => {
console.log(JSON.stringify(result));
});
}
The text was updated successfully, but these errors were encountered:
❌ Please edit your post and use the provided template when creating a new issue. This helps everyone to understand your post better and asks for essential information to quicker review the issue.
Issue Description
GeoQueries running with withinPolygon constraint do not work and return error -1 (Unknown server Error) or 1 (Internal Server Error), either when used with a Polygon such as:
or with an array of GeoPoints such as:
Steps to reproduce
Parse 4.5.0 running at Back4App
Parse-Swift in the latest version added to the project using SPM
Class with GeoPoint property contained in the area of Polygon or array of GeoPoints
Actual Outcome
Parse Error either Error -1 (Unknown Server Error) or 1 (Internal Server Error)
Message from Debug Print:
Expected Outcome
A list of objects contained in the current Polygon or GeoPoint Array.
Same code with same coordinates when used with the JS SDK return objects correctly.
JS SDK output:
Environment
Client
4.7.0 installed via SPM
XCode 13.3
Mac OSX Monterey 12.3.1
12.3.1
iOS 14.0 image
Server
4.5.0
Linux
Back4App
Database
MongoDB
3.6
Back4App
Logs
Error querying: ParseError code=1 error=Internal server error.
Code to Reproduce
Assuming you have a Class called "City" which contains a property named "location" that has a valid GeoPoint contained in the Polygon or array of GeoPoints.
The code below uses an array of GeoPoints, but the behavior is the same with a Polygon.
Same implementation in Node.JS using the JS SDK, which responds correctly with all objects:
The text was updated successfully, but these errors were encountered: