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

Incorrect handling geo-queries #187

Open
Antiavanti opened this issue Oct 24, 2015 · 13 comments
Open

Incorrect handling geo-queries #187

Antiavanti opened this issue Oct 24, 2015 · 13 comments
Labels

Comments

@Antiavanti
Copy link

Query from client:

/api/v1/collection?query={
    "geometry": {
        "$geoIntersects": {
            "$geometry": {
                "type": "Polygon",
                "coordinates": [[
                    [16.14560058593753,51.307365718453234],
                    [18.02151611328128,51.307365718453234],
                    [18.02151611328128,50.79110589223593],
                    [16.14560058593753,50.79110589223593],
                    [16.14560058593753,51.307365718453234]
                ]]
            }
        }
    }
}

Inside of req._ermQueryOptions:

{
    "query": {
        "geometry": {
            "$geoIntersects": {
                "$geometry": {
                    "type": "Polygon",
                    "coordinates": {
                        "$in": [{
                            "$in": [{
                                "$in": [16.092042236328155,51.35713184352065]
                            },
                            {
                                "$in": [17.967957763671905,51.35713184352065]
                            },
                            {
                                "$in": [17.967957763671905,50.841430047612135]
                            },
                            {
                                "$in": [16.092042236328155,50.841430047612135]
                            },
                            {
                                "$in": [16.092042236328155,51.35713184352065]
                            }]
                        }]
                    }
                }
            }
        }
    }
}

Those $in operators are wrong :)

@Zertz
Copy link
Collaborator

Zertz commented Oct 24, 2015

Interesting, if you want to take a stab at it, this is happening here.

@Antiavanti
Copy link
Author

Currently I'm handling it in pre middleware (change it back only for geojsons).
But adding $in operator in this particular case is just incorrect behavior :)

@Zertz
Copy link
Collaborator

Zertz commented Oct 24, 2015

Yes I was just pointing out the faulty code, feel free to send a PR :)

@muliyul
Copy link

muliyul commented May 2, 2016

This is confirmed to happen in 4.0.2.

My query:
image

The result:
image

@Zertz
Copy link
Collaborator

Zertz commented May 2, 2016

Is the result of sw.lng() and sw.lat() a number?

@muliyul
Copy link

muliyul commented May 3, 2016

I posted the result I'm getting in devtools... so yeah I'm pretty sure. also I double checked.
They are taken straight from the google maps api btw.

@Zertz
Copy link
Collaborator

Zertz commented May 3, 2016

Sorry, I somehow completely overlooked the second screenshot. The issue is that we look specifically for numbers, which should be fixed in is-coordinates.

isNumber(34.7403)
//= true

isNumber("34.7403")
//= false

@muliyul
Copy link

muliyul commented May 3, 2016

Do you have any release date for this?

@Zertz
Copy link
Collaborator

Zertz commented May 3, 2016

Probably sometimes this week, but nothing is set in stone.

@Zertz Zertz reopened this May 3, 2016
@muliyul
Copy link

muliyul commented May 11, 2016

Any news on this issue @Zertz ?

@Zertz
Copy link
Collaborator

Zertz commented May 11, 2016

I've been quite busy lately, though I will take some open-source time Friday and/or this weekend :-)

@muliyul
Copy link

muliyul commented May 11, 2016

I'm counting on you! I've tried to fix it but I couldn't figure out how. By the way I'm not entirely sure this has anything to do with strings as I am sending my data as number and it is verified by the is-coordinates. I'm sending a query with the type param to specify a polygon type query and it looks like the query is being understood by ERM as something entirely different.

@MaxVynohradov
Copy link

@Zertz have you any success with this issue? I'm going to use this library, and seems will deal with coordinates.

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

No branches or pull requests

4 participants