Skip to content

withinPolygon support for Polygon object #4067

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

Merged
merged 10 commits into from May 22, 2018
Merged

withinPolygon support for Polygon object #4067

merged 10 commits into from May 22, 2018

Conversation

madsb
Copy link
Contributor

@madsb madsb commented Jul 31, 2017

This pull request add support for Polygon objects besides arrays of GeoPoints.

madsb added 3 commits July 31, 2017 16:59
Polygon object in $polygon query
$geoIntersects queries
@codecov
Copy link

codecov bot commented Jul 31, 2017

Codecov Report

Merging #4067 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4067      +/-   ##
=========================================
+ Coverage   92.68%   92.7%   +0.02%     
=========================================
  Files         119     119              
  Lines        8663    8679      +16     
=========================================
+ Hits         8029    8046      +17     
+ Misses        634     633       -1
Impacted Files Coverage Δ
...dapters/Storage/Postgres/PostgresStorageAdapter.js 97.24% <100%> (+0.1%) ⬆️
src/Adapters/Storage/Mongo/MongoTransform.js 86.83% <100%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df274dc...8034f73. Read the comment docs.

@@ -628,4 +738,60 @@ describe('Parse.GeoPoint testing', () => {
done();
});
});

it('support $geoIntersects queries', (done) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it does. Duplicate removed.

@madsb
Copy link
Contributor Author

madsb commented Sep 19, 2017

I can see the tests are failing with postgres, but I'm not that well versed with that database. If someone is able to fix the tests I'd be grateful.

if (polygon.length < 3) {
let points
if (typeof polygon === 'object' && polygon.__type === 'Polygon') {
if (!polygon.coordinates && polygon.coordinates.length < 3) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!polygon.coordinates || polygon.coordinates.length < 3

Using OR here instead of AND passes test. You might want to do the same with mongo and check your logic

fail(`no request should succeed: ${JSON.stringify(resp)}`);
done();
}).catch((err) => {
expect(err.error.code).toEqual(1);
Copy link
Member

@dplewis dplewis Sep 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error should be 107 or Parse.Error.INVALID_JSON

@dplewis
Copy link
Member

dplewis commented Mar 7, 2018

@madsb ping?

@dplewis dplewis requested a review from flovilmart May 19, 2018 00:31
@dplewis
Copy link
Member

dplewis commented May 19, 2018

@flovilmart I added withinPolygon before PFPolygon. This will allow support without doing the conversion from PRPolygon to Array of PFGeoPoint in the SDK's.

@flovilmart
Copy link
Contributor

That sounds rad. What’s next on this one?

@dplewis
Copy link
Member

dplewis commented May 19, 2018

@madsb How does this look? @flovilmart I think this is good to go.

@dplewis dplewis dismissed their stale review May 19, 2018 01:20

fixed

@flovilmart flovilmart merged commit 57da2de into parse-community:master May 22, 2018
@flovilmart
Copy link
Contributor

All good then thanks @madsb and @dplewis

UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this pull request Mar 21, 2020
* Whitespace

* Add Polygon type to $polygon query

* Add tests

Polygon object in $polygon query
$geoIntersects queries

* Refactor

* Postgres support

* More tests

* Remove duplicate test

* Missing semicolon

* fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants