Skip to content
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

Request: PyEve supporting $centerSphere operator #1181

Closed
Irene-GM opened this issue Aug 24, 2018 · 2 comments
Closed

Request: PyEve supporting $centerSphere operator #1181

Irene-GM opened this issue Aug 24, 2018 · 2 comments
Milestone

Comments

@Irene-GM
Copy link

Hi,

I wonder whether it is possible for the Py-Eve developer community to include support for the $centerSphere operator via HTTP, so we can build spatial queries with a search radius and fetch the associated data from a Mongo database. This question was originally asked in SO, and following the suggestion of a user, I decided to make this request.


Expected Behavior

The following query is possible in a Mongo console environment:

db.ObsStationTemp.find({geometry:{$geoWithin:{$centerSphere:[[4.925922,51.969035],2/3963.2]}}})

So its equivalent in HTTP should pull the same set of values from the Mongo database:

 http://127.0.0.1:5000/ObsStationTemp?where={"geometry": {"$geoWithin": {"$centerSphere": [ [4.92592, 51.969035],0.02]}}}

Actual Behavior

However, the Eve server replies as follows:

{
   "_status": "ERR",
   "_error": {
       "code": 400,
       "message": "Query contains unknown or unsupported operators: $centerSphere"
   }
}

Because it seems that the $centerSphere is not yet supported in PyEve 0.8.
Are there any plans to include this operator in a new release of PyEve?
Thanks for your support!

@nicolaiarocci
Copy link
Member

Hello, this feature should be relatively easy to add. Thanks for reporting and of course, feel free to submit a PR

@Irene-GM
Copy link
Author

Hi,

Thanks a lot for the quick response to solve this problem! Much appreciated!

We tried the 0.8.1dev version of PyEve with this particular case that we were posing above and it works. However, we think it is worth to mention that then we tried to add a search radius based in a division, and it seems that PyEve is not able to understand the division, perhaps due to parsing. We understand that we can do the division by ourselves, but maybe this functionality is interesting to mimic the behavior of MongoDB.

Thus, this query works via Postman:

http://127.0.0.1:5000/ObsStationTemp?where={"geometry": {"$geoWithin": {"$centerSphere": [ [4.92592, 51.969035],0.0001]}}}

But this one does not:
http://127.0.0.1:5000/ObsStationTemp?where={"geometry": {"$geoWithin": {"$centerSphere": [ [4.92592, 51.969035],1/6378.1]}}}

We are not sure whether this is that we are making a mistake, or that PyEve does not understand the operation. Can you let us know about this?

Thanks!

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

No branches or pull requests

2 participants