-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latitude & Longitude misplacement of decoding ParsePolygon. #115
Comments
Can you post the actual error returned from the server. What happens when you run the Playground code? Parse-Swift/ParseSwift.playground/Pages/1 - Your first Object.xcplaygroundpage/Contents.swift Lines 398 to 415 in 57ccb4b
|
ParsePolygon.swift, line: 108. the order of a point in the polygon should be [lat, lon]. |
There won't be error, because the value is decodable. but the order is misplaced, so if u really generate a sequence of coordinates, save into db, then use ParseSwift to decode it and place them back on map. you will find the error. |
You stated it caused a decoding error, this is the error I was referring to:
My tests show that the current implementation is correct (for Postgres and Mongo). The server needs
I've updated the Playground examples so you can run them directly to test what I mentioned above: Parse-Swift/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift Lines 68 to 113 in 80347b7
Which results in the following output: # Postgres
Saved location: {"__type":"GeoPoint","latitude":40,"longitude":-30}
Saved polygon: {"__type":"Polygon","coordinates":[[-30,35],[-35,42],[-20,42]]}
Saved polygon geopoints: [{"__type":"GeoPoint","latitude":35,"longitude":-30}, {"__type":"GeoPoint","latitude":42,"longitude":-35}, {"__type":"GeoPoint","latitude":42,"longitude":-20}]
# Mongo
Saved location: {"__type":"GeoPoint","latitude":40,"longitude":-30}
Saved polygon: {"__type":"Polygon","coordinates":[[-30,35],[-35,42],[-20,42]]}
Saved polygon geopoints: [{"__type":"GeoPoint","latitude":35,"longitude":-30}, {"__type":"GeoPoint","latitude":42,"longitude":-35}, {"__type":"GeoPoint","latitude":42,"longitude":-20}] The following test was improved to ensure all of the aforementioned is maintained: Parse-Swift/Tests/ParseSwiftTests/ParsePolygonTests.swift Lines 77 to 88 in 2688192
|
It looks like there may be a small bug here as the server handles saved polygons and queried polygons differently. Still investigating... See #118 |
New Issue Checklist
Issue Description
Latitude & Longitude misplacement of decoding ParsePolygon: The order of the element in polygon is [lat, lon], the current decoding order is misplacement. The error is found at ParsePolygon: 108.
Steps to reproduce
Use [[25.1234, 121.4567], [24.321, 121.1234], [22.11, 101.321]] as test polygon data in database. Caused a decoding error.
Actual Outcome
error.
Expected Outcome
a sequence of GeoPoint.
Environment
5.7.0
Client
5.7.0
14.3.1
macOS
13.4
Server
6.2.0
Ubuntu 20.04 LTS
Linode
Database
MongoDB
6.0.6
Linode
Logs
The text was updated successfully, but these errors were encountered: