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

Comments

Projects
None yet
2 participants
@Irene-GM

Irene-GM commented Aug 24, 2018

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

This comment has been minimized.

Show comment
Hide comment
@nicolaiarocci

nicolaiarocci Aug 27, 2018

Member

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

Member

nicolaiarocci commented Aug 27, 2018

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

@Irene-GM

This comment has been minimized.

Show comment
Hide comment
@Irene-GM

Irene-GM Aug 28, 2018

Hi,

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

We tried the 0.8.1dev version ofPyEve 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!

Irene-GM commented Aug 28, 2018

Hi,

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

We tried the 0.8.1dev version ofPyEve 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