Skip to content

Problem with geo functions #4409

@sde-melo

Description

@sde-melo

What version of Dgraph are you using?

1.1.0 and 1.0.17

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

Docker image run on an Ubuntu VM on Windows

Steps to reproduce the issue (command/config used to run Dgraph).

I encounter a problem with geo functions. My queries return some results which they should not.

Here are my test set:

{
  set {
    _:a <name> "A" .
    _:a <loc> "{'type': 'Polygon', 'coordinates': [[[ 2.57080078125, 51.04139389812637 ], [ -4.89990234375, 48.45835188280866 ], [ -1.9335937499999998, 43.34116005412307 ], [ 3.3837890625, 42.261049162113856 ], [ 7.536621093749999, 43.8186748554532 ], [ 8.173828125, 49.009050809382046 ], [ 2.57080078125, 51.04139389812637 ]]]}"^^<geo:geojson> .
    
    _:b <name> "B" .
    _:b <loc> "{'type': 'Polygon', 'coordinates': [[[ 138.25195312499997, -10.40137755454354 ], [ 111.533203125, -24.926294766395582 ], [ 116.3671875, -35.532226227703376 ], [ 149.501953125, -38.13455657705412 ], [ 154.072265625, -26.588527147308614 ], [ 138.25195312499997, -10.40137755454354 ]]] }"^^<geo:geojson> .
    
    _:c <name> "C" .
    _:c <loc> "{'type': 'Polygon', 'coordinates': [[[105.701,-10.511],[105.683,-10.474],[105.645,-10.466],[105.629,-10.437],[105.655,-10.415],[105.715,-10.384],[105.737,-10.384],[105.751,-10.394],[105.752,-10.484],[105.736,-10.505],[105.701,-10.511],[105.701,-10.511]]]}"^^<geo:geojson> .
  }
}

and my query:

{
  node(func: contains(loc, [2.5, 46.0])) {
    uid
    name
    loc
  }
}

Expected behaviour and actual result.

I have tried in Dgraph 1.0.17 and 1.1.0 for the same results: this query returns polygons A and C instead of polygon A only as I am expecting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/indexesRelated to indexes (indices) and their usage.area/querylang/geoIssues related to geolocation.kind/bugSomething is broken.status/acceptedWe accept to investigate/work on it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions